Office 365 and Classic ASP vs. VB.net SMTP Settings -


there several questions classic asp , office 365, none seem answer particular scenario, here goes.

i set email account on office 365 , trying smtp test following code:

dim objsendmail, mailsubject, mailbody set objsendmail = createobject("cdo.message") mailsubject = "test" mailbody = "test" objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com" objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 240 objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email@domain.com" objsendmail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password" objsendmail.configuration.fields.update  objsendmail.to = "to_email@anotherdomain.com" objsendmail.subject = mailsubject objsendmail.from = """from name"" <email@domain.com>" 'objsendmail.htmlbody = "this body" objsendmail.textbody = mailbody objsendmail.send 

this generates following error:

cdo.message.1 error '80040213'

the transport failed connect server.

i've figured out it's due smtpusessl setting, need that, , if turn off error '8004020e'.

now, here's weird thing...i can smtp test using vb.net , code below:

    dim mailclient new smtpclient("smtp.office365.com")     mailclient.port = 587     mailclient.enablessl = true     'your network credentials going office 365 email address , password     dim cred new system.net.networkcredential("email@domain.com", "password")     mailclient.credentials = cred     dim message new mailmessage()     message.from = new mailaddress("email@domain.com", "from name")     message.[to].add("to_email@anotherdomain.com")     message.subject = "test office 365 smtp"     message.body = "test body"     mailclient.send(message) 

this tells me shouldn't need configure on server classic asp version work...which site i'm working on built in. question have is...what stupid setting missing rid of transport error?

thanks.

try port 25 instead of 587. of other settings, including smtpusessl, can remain same.

i suspect problem port 587 cdo.message doesn't support protocol required (tls? msa?). found few other internet posts stating same problem asp/vbscript , port 587 .net applications did not have problem.


Comments