Tag Archive | "Gmail ASP script"

Tags:

Configure ASP to send mails via gmail


‘Create CDO.Message object instance
Set myMail = CreateObject("CDO.Message")

‘Set SMTP Authentication
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ’1 means using local smtp, 2 is for outside smtp

‘SMTP Server domain name
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

‘Server port, gmail use ssl smtp authentication, port number is 465
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
‘Authentication method, ssl or not, Username and password for the SMTP Server
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ‘CDOBasic authentication
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") = "Gmail Address"
myMail.Configuration.Fields.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Gmail Password"

myMail.Configuration.Fields.Update

myMail.Subject = strSubject
myMail.From = strEmailFrom
myMail.To = strEmailTo
myMail.TextBody = strBody
myMail.Send

set myMail=nothing

Share

Posted in Linux-Apache-PHPComments (0)