Advertisement

06.18.2008 at 07:24PM PDT, ID: 23497528
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

error '80040211' when trying to use the CDO Mailer in ASP.

Asked by JA67 in Active Server Pages (ASP), Microsoft IIS Web Server

Tags: , ,

I am using the below code, that I got from my hosting services (Aplus) web site, but I am getting the error denoted below. Can you please help me get this working? I'm probably doing something wrong.

I have this code all in one asp page named myasp.asp. Is that the correct way to do it? Soemthing makes me think I should have two files - can an ASP page post to itself?

All I am trying to to is have a form on my web site where a person will provide their email address and maybe some other info, click Submit, and have the page automatically send them an emai with a link. I think I have the right code here to do this but can't get it to work. I know the email addresses specifified in the code are not real, but I have real addresses in them on my page.


HERE IS THE ERROR I GET WHEN I HIT THE SUBMIT BUTTON
"error '80040211'  /myasp.asp, line 77 objMessage.Send"
FYI:  Line 77 is the line that contain this: "objMessage.Send"


HERE IS THE CODE I AM USING
<!-------------begin form------------>
<%
Dim strFrom, strSubject, strBody 'Strings for fromaddress, subject, body
Dim objCDOMail 'The CDO object

sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
      'cdoSendUsingPort
      .Item(sch & "sendusing") = 2

      'Email Server
      .Item(sch & "smtpserver") = "pro44.abac.com"

      'Basic authentication
      .Item(sch & "smtpauthenticate") = 1

      'Type your email account below
      .Item(sch & "sendusername") = "email@somewhere.com"

      'Type your email password below
      .Item(sch & "sendpassword") = "xxxxx"

      .Item(sch & "smtpserverport") = 465
      
      'SSL connection enabled
      .Item(sch & "smtpusessl") = true
      .update
End With


'First we'll read in the values entered
strFrom = Request.Form("from")

'These would read the message subject and body if we let you enter it
strSubject = Request.Form("subject")
strBody = Request.Form("body")

' Some spacing
strBody = strBody & vbCrLf & vbCrLf

' Initiate Is email valid sub function
If strFrom = "" Or Not IsValidEmail(strFrom) Then

' Create Form
%>
<FORM ACTION="myasp.asp" METHOD="post">
Enter your e-mail address:<BR>
<INPUT TYPE="text" NAME="from" SIZE="30"></INPUT><BR><BR>

Subject:<BR>
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR><BR>

Message:<BR>
<TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>

<INPUT TYPE="submit" VALUE="Send Mail"></INPUT>
</FORM>
<%
Else
' Create an instance of the NewMail object.
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = cdoConfig

' Set the properties of the object
objMessage.From = strFrom
objMessage.To = "email@somewhere.com" 'The recipient of the form data
objMessage.Subject = strSubject
objMessage.TextBody = strBody

' Some useful extra variables
'objMessage.Cc = ""
'objMessage.Bcc = ""

' Send the message!
objMessage.Send

' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objMessage = Nothing

' Set your Response after the Send Mail button is pushed.
Response.Write "Your Message was sent!"

End if
' End page logic
%>

<% ' Only functions and subs follow!

' A quick email syntax checker.
Function IsValidEmail(strEmail)
 Dim bIsValid
 bIsValid = True

 If Len(strEmail) < 5 Then
  bIsValid = False
 Else
  If Instr(1, strEmail, " ") <> 0 Then
   bIsValid = False
  Else
   If InStr(1, strEmail, "@", 1) < 2 Then
    bIsValid = False
   Else
    If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
     bIsValid = False
    End If
   End If
  End If
 End If

 IsValidEmail = bIsValid
End Function
%>
<!-------------end form------------>



Start Free Trial
 
Loading Advertisement...
 
[+][-]06.18.2008 at 11:11PM PDT, ID: 21819599

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 06:08AM PDT, ID: 21821729

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 06:11AM PDT, ID: 21821758

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), Microsoft IIS Web Server
Tags: ASP, IE 7, error '80040211'
Sign Up Now!
Solution Provided By: dosth
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.19.2008 at 06:30AM PDT, ID: 21821919

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 06:40AM PDT, ID: 21822004

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628