Solved

Classic ASP using CDOSYS problems

Posted on 2004-04-07
4
1,103 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC connection string for ODBC 6.01 24 72
iis reverse proxy virtual directory 8 133
How can i convert a Generic list to DataTable in c# 3 764
Dreamweaver server behavior gone 6 112
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 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/…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

17 Experts available now in Live!

Get 1:1 Help Now