email - ASP JMail 4.5 SMTP Authentication for Office365 -


we have old apps written in classic asp send mail using jmail (w3jmail v 4.5). in process of moving local microsoft exchange server office 365. need these old apps continue work, using jmail send e-mail.

our current asp code (which references exchange server ip):

set objmail = server.createobject("jmail.message") objmail.mailserverusername = "domain\username" objmail.mailserverpassword = "password" objmail.contenttype = "text/plain" objmail.from = "name1@domain.co.uk" objmail.addrecipient "name2@domain.co.uk" objmail.subject = "test" objmail.body = "test" objmail.send("10.10.10.1") set objmail = nothing 

this new version have try , use our office 365 account:

set objmail = server.createobject("jmail.message") objmail.silent = true objmail.logging = true objmail.mailserverusername = "name1@domain.co.uk" objmail.mailserverpassword = "password" objmail.contenttype = "text/plain" objmail.from = "name1@domain.co.uk" objmail.addrecipient "name2@domain.co.uk" objmail.subject = "test" objmail.body = "test" if objmail.send("smtp.office365.com:587")     response.write "sent e-mail..." else     response.write( "errorcode: " & objmail.errorcode & "<br />" )     response.write( "errormessage: " & objmail.errormessage & "<br />" )     response.write( "errorsource: " & objmail.errorsource & "<br /><br />" )     response.write( "" & objmail.log & "<br /><br />" ) end if set objmail = nothing 

i know our username , password correct, , host name correct.

this taken log output:

auth login  <- 504 5.7.4 unrecognized authentication type authentication failed.   smtp.office365.com:587 failed..   no socket server. connecttoserver() 

how can set authentication type using jmail..?

try changing port 587 25. office365 smtp server seems prefer this

(nb don't know if applies jmail apply cdo , third party mail components in classic asp seem wrappers cdo.)

edit - cdo example, tried , tested smtp.office365.com

dim objmail, iconfg, flds set objmail = server.createobject("cdo.message") set iconfg = server.createobject("cdo.configuration") set flds = iconfg.fields flds          .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2         .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"         .item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25         .item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1         .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "me@mydomain.com"         .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"         .item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true     .update end         objmail.configuration = iconfg         objmail.to = request.form("recipient")         objmail.from = "me@mydomain.com"             objmail.subject = "email form submission"         objmail.textbody = request.form("message")         objmail.send  set objmail = nothing 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -