Tony
Tony

Reputation: 97

Classic ASP - Sending Email To Own Domain with CDOSYS fails

I have a classic asp email script that uses authenticated CDOSYS to send to emails from a database. It's running on a Parallels Plesk Windows 2008 server.

This works fine for all email addresses except for any addresses that belong to sites on the server I am sending from.

I could authenticate using a Google Apps email account (the domain is set up using Google Apps for email) BUT I would run up against Google' 24 hour sending limits each time the client ran the script.

Can anyone point out where I'm going wrong or explain why email to sites on the sending server causes an error? The error is

error '8004020f'
/admin/send-group-email.asp, line 128

which is the objCDO.Send line

The Code :

(primarydomain.com is the domain name of the primary account the site lives under in Parallels. The SenderEmail value would be, for example, [email protected])

Set cdoConfig = CreateObject("CDO.Configuration")  

    With cdoConfig.Fields  
        .Item(cdoSendUsingMethod) = cdoSendUsingPort  
        .Item(cdoSMTPServer) = "localhost"  
        .Item(cdoSMTPAuthenticate) = 1  
        .Item(cdoSendUsername) = "[email protected]"  
        .Item(cdoSendPassword) = "thepassword"  
        .Update  
    End With 

   while (NOT RS_Emails.EOF)
      Dim objCDO      
      set objCDO = Server.CreateObject("CDO.Message")
      objCDO.Configuration = cdoConfig
      objCDO.From = CStr(Request.Form("SenderEmail")) & " (" & CStr(Request.Form("SenderName")) & ")"
      objCDO.To = RS_Emails.Fields.Item("email").Value
      objCDO.Subject = CStr(Request.Form("Subject"))
      objCDO.HTMLBody = message
      objCDO.Send
      set objCDO = Nothing
      RS_Emails.MoveNext
    Wend
      set cdoConfig=Nothing

Upvotes: 1

Views: 987

Answers (1)

Ynhockey
Ynhockey

Reputation: 3932

This is most likely a server issues which can be solved with Plesk.

Please look at the following link: http://mkb-training.com/index.php?option=com_content&view=article&id=1:setting-up-google-apps-with-plesk&catid=1:google-tutorial&Itemid=2

Pay attention to the following: "Uncheck the MX1: "Domain IP also used for mail server"" (there are screenshots there on how to do this). I am not 100% sure about Plesk, but in H-Sphere (another Parallels control panel) doing this is essential for being able to send from the server to your own domain when you have a remote mail exchanger.

Also make sure that no MX records point to your server (even if the Google Apps ones are configured correctly).

Upvotes: 1

Related Questions