Solved

Classic ASP using CDOSYS problems

Posted on 2004-04-07
4
1,105 Views
Last Modified: 2008-02-01
Hi,

I've been trying to use classic ASP with CDOSYS to create an auto-email after a user have submitted a form.  I kept on getting the 8004020f error, which is reciepient address rejected by server. but both the to and from email account are real.  Some background info, the web server and mail server is two separate server.  We use MDaemon mail server.  Here's the codes:

<%
      first = trim(replace(Request.Form("strFirstName"), """", "&quot;"))
      last = trim(replace(Request.Form("strLastName"), """", "&quot;"))
      dayPhone = trim(replace(Request.Form("strDayPhone"), """", "&quot;"))
      eveningPhone = trim(replace(Request.Form("strEveningPhone"), """", "&quot;"))
      callTime = trim(replace(Request.Form("strCallTime"), """", "&quot;"))
      city = trim(replace(Request.Form("strCity"), """", "&quot;"))
      country = trim(replace(Request.Form("strCountry"), """", "&quot;"))
      email = trim(replace(Request.Form("strEmail"), """", "&quot;"))
      about = trim(replace(Request.Form("strAbout"), """", "&quot;"))
      language = trim(replace(Request.Form("strLanguage"), """", "&quot;"))
      confirmMsg = "Thank you for your interest!  One of our representative will contact you shortly."
      
      Set Mailer = Server.CreateObject("CDO.Message")
      Mailer.From = "system@ourcompany.com"
      Mailer.Sender = "system@ourcompany.com"
      Mailer.To ="user@requestinfo.com"
      Mailer.Subject =  "Licensing Information Request"

      MsgBody = "Hello!<br>There is a request for licensing information.  These are the information:<br><br>" &_
                  "<table width='100%' cellpadding='0' cellspacing='5' ID='Table1'>" &_
                  "<tr><table width='100%' cellpadding='0' cellspacing='5' border='0' ID='Table2'>" &_
                  "<tr width='80'><td>First Name:</td><td>" & first & "</td></tr>" &_
                  "<tr width='80'><td>Last Name:</td><td>" & last & "</td></tr>" &_
                  "<tr width='80'><td>Day Telephone #:</td><td>" & dayPhone & "</td></tr>" &_
                  "<tr width='80'><td>Evening Telephone #:</td><td>" & eveningPhone & "</td></tr>" &_
                  "<tr width='80'><td>Best Time To Call:</td><td>" & callTime & "</td></tr>" &_
                  "<tr width='80'><td>City:</td><td>" & city & "</td></tr>" &_
                  "<tr width='80'><td>Country:</td><td>" & country & "</td></tr>" &_
                  "<tr width='80'><td>Email Address:</td><td>" & email & "</td></tr>" &_
                  "<tr width='80'><td valign='top'>How Did You Hear About Us:</td><td>" & about & "</td></tr>" &_
                  "<tr width='80'><td>Prefered Language:</td><td>" & language & "</td></tr>" &_
                  "<tr></tr></table>"      
      
      Mailer.HTMLBody = MsgBody
      
      Mailer.Configuration.Fields.Item _
            ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

      'Name or IP of Remote SMTP Server
      Mailer.Configuration.Fields.Item _
            ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="our company ip"

      'Server port (typically 25)
      Mailer.Configuration.Fields.Item _
            ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      
      'Use SSL for the connection (False or True)
      Mailer.Configuration.Fields.Item _
            ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

      'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
      Mailer.Configuration.Fields.Item _
            ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

      Mailer.Configuration.Fields.Update
 
    If g_bDebug Then
           response.write "Send mail error: <br>"
         Response.write Mailer.GetStream.ReadText
    Else
         Mailer.Send
              response.write "Mail sent!"
    End If
%>

Any hints?

Lina
0
Comment
Question by:KeikoWasabi
4 Comments
 
LVL 7

Expert Comment

by:ramesh12
ID: 10779906
    'Name or IP of Remote SMTP Server
     Mailer.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="our company ip"

here did you provide your mail server IP or You web server IP
0
 

Author Comment

by:KeikoWasabi
ID: 10780478
I've put our mail server IP.

the error i got is for the .Send line.

Lina
0
 
LVL 2

Accepted Solution

by:
pheine earned 125 total points
ID: 10781561
typical problem...

at mailer.send, your webserver connects anonymously to the mail server, so your mail server should support anonymous access.
also most mail servers can only send mails with an 'well known' email adress in the From field. in fact an email adress which is hosted by himself (for security issues)
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10784682
You need to allow relays on your SMTP server for the IP address of the machine that is sending the email.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question