Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Classic ASP using CDOSYS problems

Posted on 2004-04-07
4
Medium Priority
?
1,115 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 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

877 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