Solved

Classic ASP using CDOSYS problems

Posted on 2004-04-07
4
1,109 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

623 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