Classic ASP - Website Emails using Office 365

Discussion in 'Email' started by MarkShawe, Apr 12, 2015.

  1. Hi,

    I am trying to send emails from my Classic ASP website.
    We have recently upgraded our emails to Microsoft Office 365 and now I have to update my website to get the emails to send again.

    I have the following code:

    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    Set Flds = objConfig.Fields

    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="outlook.office365.com"

    ' ' Passing SMTP authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
    Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"

    Flds.update
    Set objMessage.Configuration = objConfig
    objMessage.To = "[email protected]"
    objMessage.From = "[email protected]"
    objMessage.Subject = "New Task"
    objMessage.fields.update
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."
    objMessage.Send

    response.Redirect ("test-emails.asp?complete=1")
    response.end

    The generates a generic error:

    error '8004020e'
    /administration/mobile/test-emails.asp, line 31 (in bold above)

    I am not sure of the correct settings and can't seem to find them anywhere, any help would be greatly received!

    Thanks in advance.
     
  2. FredC

    FredC Winhost Staff

    We need more information. pls open a support ticket.
     

Share This Page