Hi there,
I am usually a CDONTS man but the hosting company say I must use CDOSYS.
The following code seems to only work correctly when the recipients email address is the same as the sender address.
I have tried to send the email to Hotmail, Yahoo and GMail accounts and it does not send. No error messages, just is not received in the inbox of the account.
Any suggestions would be appreciated.
Code:<!--#include file="values/inc_const_cdo.asp"--> <% dim strMailSubject strMailSubject = rsNewletter.Fields.Item("NewsletterSubject").Value strMailMessage = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbCrLf strMailMessage = strMailMessage & "<html>" strMailMessage = strMailMessage & "<head>" strMailMessage = strMailMessage & "<title>" strMailMessage = strMailMessage & strMailSubject strMailMessage = strMailMessage & "</title>" strMailMessage = strMailMessage & "</head>" strMailMessage = strMailMessage & "<body>" strMailMessage = strMailMessage & "Hello World" strMailMessage = strMailMessage & "</body>" strMailMessage = strMailMessage & "</html>" ' mail server parameters for CDOSYS const strSenderDomain = "domain.com" ' hostname of sending domain const strSMTPUserName = "info" ' username for mailserver authentification const strSMTPPassword = "password" ' password for authentication const strSMTPServerName = "mail" ' DNS name of mail server const strToName = "recipient" ' Friendly Name to appear as recipient const strReplyTo = "info" ' Sender email address this will be the white list address const strFromName = "Newsletter" ' Friendly name for sender dim strMailServer dim strSMTPUser dim strDefMailName dim strDefMailTo dim strBccList dim strCcList strSMTPUser = strSMTPUserName & "@" & strSenderDomain strMailServer = strSMTPServerName & "." & strSenderDomain strMailSubject = strCompanyName & " " & strMailListSubject strDefMailName = strFromName & " <" & strReplyTo & "@" & strSenderDomain & ">" strDefMailTo = strToName & " <" & strReplyTo & "@" & strSenderDomain & ">" if strMailFrom = "" then strMailFrom = strDefMailName if strMailTo = "" then strMailTo = strDefMailTo dim iConf dim Flds dim objNewMail Set iConf = Server.CreateObject ("CDO.Configuration") Set Flds = iConf.Fields Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = strSMTPUser Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strSMTPPassword Flds.Update Set objNewMail = Server.CreateObject("CDO.Message") Set objNewMail.Configuration = iConf Err.Clear objNewMail.To = "NAME <email@domain.com>" if strCCList <> "" then objNewMail.cc = strCCList end if if strBccList <> "" then objNewMail.bcc = strBccList end if objNewMail.From = "SENDER <email@domain.com>" objNewMail.Subject = "Newsletter - " & rsNewletter.Fields.Item("NewsletterSubject").Value 'objNewMail.TextBody = strMailMessage objNewMail.HTMLBody = strMailMessage On Error Resume Next if bDebug then response.write strMailTo & "<br>" & strBccList & "<br>" & strccList else objNewMail.Send end if If Err <> 0 Then response.write "Sorry the email was not sent" CDOSYSMail = Err else CDOSYSMail = true end if set Flds = nothing set iConf = nothing Set objNewMail = nothing %>






Bookmarks