Results 1 to 1 of 1

Thread: CDOSYS: No email is getting sent

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    CDOSYS: No email is getting sent

    Hi all.

    I am trying CDOSYS code to send out email.
    The problem is when I try to send email to gmail and hotmail account, it never works.
    Means, no email appears at gmail and hotmail account.
    But when I send it to yahoo mail, it works.
    I run the code at localhost. I use Win XP Pro.
    I just wonder why this happen.
    Can someone explain to me ?

    Below is the code that Im trying out :
    Code:
    <%
    	'----------------------------------------------------------------------------
    	'
    	'	Send email using the CDOSYS component
    	'
    	'	by Chris Hardy
    	'	http://www.chrishardy.co.uk/
    	'
    	'----------------------------------------------------------------------------
    
      Option Explicit
    
      dim sName, sEmail, sMessage
    	dim oCdoMail, oCdoConf, sConfURL
    
      if Request.Form("Action") <> "" then
        sName = Request.Form("Name")
        sEmail = Request.Form("Email")
        sMessage = Request.Form("Message")
    
    		Set oCdoMail = Server.CreateObject("CDO.Message")
    		Set oCdoConf = Server.CreateObject("CDO.Configuration")
    
    		sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
    
    		with oCdoConf
    			.Fields.Item(sConfURL & "sendusing") = 1
    			.Fields.Item(sConfURL & "smtpserver") = "localhost"
    			.Fields.Item(sConfURL & "smtpserverport") = 25
    			.Fields.Update
    		end with
    
    		with oCdoMail
    			.From = "[email protected]"
    			.To = sEmail
    			.Subject = "My message subject"
    			.TextBody = sMessage
    			.HTMLBody = sMessage
    			.Configuration = oCdoConf
    			.Send
    		end with
    
    		Set oCdoConf = Nothing
    		Set oCdoMail = Nothing
    
        response.write "Thanks for your message!"
      else
    %>
    <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
    <p>Name:<br /><input type="text" name="Name" /></p>
    <p>E-mail:<br /><input type="text" name="Email" /></p>
    <p>Message:<br /><textarea name="Message"></textarea></p>
    <p><input type="submit" name="Action" value="Send" /></p>
    </form>
    <%
      end if
    %>
    Last edited by azrina; Aug 24th, 2007 at 04:14 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width