SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    SitePoint Evangelist
    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"-->
    
    ...
    OR is it...
    Code:
    <!--#include file="values/inc_const_cdo.asp"-->
    <%
    ...
    (Notice <% placement)

    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.

  3. #3
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Wizard gRoberts's Avatar
    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

  5. #5
    SitePoint Wizard gRoberts's Avatar
    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

  6. #6
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation

    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.
    I'd suggest removing your contact details from your whois as well. My report came back with:

    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.

    Gav
    Last edited by gRoberts; May 3, 2005 at 23:27.

  7. #7
    SitePoint Zealot Grantspad69's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Gav,

    I have sent you a private message in relation to the code

  8. #8
    Original Gangster silver trophy Thing's Avatar
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •