SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: CDOSYS - Not Sending mail?
-
Apr 24, 2005, 12:04 #1
CDOSYS - Not Sending mail?
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 %>
Last edited by Grantspad69; Apr 25, 2005 at 01:52.
-
Apr 24, 2005, 15:45 #2
- Join Date
- Sep 2003
- Location
- San Diego, CA
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think this might just be a type when you posted... but is your code really...
Code:<% <!--#include file="values/inc_const_cdo.asp"--> ...
Code:<!--#include file="values/inc_const_cdo.asp"--> <% ...
If its the first one, switch to 2nd one, and then try...
But I don't really know CDOSYS that good (I use JMail), so I can't help you there.
-
Apr 25, 2005, 01:42 #3
Hi KGH,
It is a typo when I have posted and my code is actually...
<!--#include file="values/inc_const_cdo.asp"-->
<%
Thanks for the suggestion though
-
Apr 25, 2005, 09:54 #4
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
have you tried using a static smtp address instead? Just for testing purposes stick your smtp addy in there and does it send? If not there is something wrong with the coding.
Do you get any error messages?
Gav
-
Apr 25, 2005, 13:10 #5
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Since your a local man... why don't you change hosts to designerhosting.co.uk, their situated in Peterlee, and im from Gateshead my self.
If you can't do that, then i'd suggest changing your coding, start off simple and check that it sends using a normal cdosys script, using general text instead of variables.
Then start adding variables, if it fails after you've added a new variable, remove it and try again, if it works, find out why it's not working? Try writing when your storing in the variable, does it work? If not theres your problem, if it does then :S i can't help you as much as I thought I could.
Gav
-
Apr 25, 2005, 13:13 #6
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
p.s.
To avoid receiving large amounts of unsolicited mail, all contact details, such as address and telephone number have been removed from this site.
EDIT!: Whois information removed at users request; Gavin
I'd thought I would give you heads up before you still get any crap from people.
GavLast edited by gRoberts; May 3, 2005 at 23:27.
-
Apr 29, 2005, 06:23 #7
Cheers Gav,
I have sent you a private message in relation to the code
-
Apr 29, 2005, 10:00 #8
- Join Date
- Oct 2000
- Location
- Philadelphia, PA
- Posts
- 4,708
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
I've heard of this issue before, but have never experienced it myself.
Check your mailroot folder on your server for the email
C:\inetpub\mailroot
Depending where it is stored can help you troubleshoot the problem. If it's not there then you know the email left your server."Does this napkin smell like chloroform?"
...now with SnapFoo!
My Blog | My Twitter | My Company | SitePoint Podcast
*** Matt Mullenweg on the SitePoint Podcast ***
Bookmarks