I am trying to send an email from a website through the outlook server. It works fine to send one email, but if I try to send a second email it fails. I’ve tried different permutations, but here’s my current code:
mailServer.address = “smtp-mail.outlook.com”
mailServer.port = 587
mailServer.SMTPConnectionMode=mailServer.ModeSSLTLS
mailServer.username =
mailServer.password =
mailserver.Connect 'don’t know if this is actually needed
if mailserver.Messages.Ubound>-1 then
’ if a previous message exists, this should clear it
mailserver.Messages.Remove(0)
end if
admmail.addRecipient tmpEmail
'admmail.headers.appendHeader “X-Mailer”,“Match SMTP” 'added in open event of webpage
admmail.fromAddress="announcements1@setonhome.org"
admmail.subject=webpage1.curlocation+" conference information"
admmail.BodyHTML="Here is information on the conference you requested :
"+tmp_line
mailServer.messages.append admmail
mailServer.SendMail
admmail and mailserver are both properties of the webpage so should not go out of scope before sending. After sending the first time, there is an lasterrorcode of 102, which I’m not sure is significant. But after trying to send a second time, there is an error code of 336031996. I have also tried with the gmail server, and I get exactly the same result and error codes.
Any help would be appreciated.