Solved

Classic ASP using CDOSYS problems

Posted on 2004-04-07
4
1,097 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
Comment Utility
    '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
Comment Utility
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
Comment Utility
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
Comment Utility
You need to allow relays on your SMTP server for the IP address of the machine that is sending the email.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now