CDOSYS Mail Form ? Anyone ?!?
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10960
Printed Date: 28 March 2026 at 2:21pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: CDOSYS Mail Form ? Anyone ?!?
Posted By: neotrix
Subject: CDOSYS Mail Form ? Anyone ?!?
Date Posted: 22 June 2004 at 11:14pm
|
Hello!
I have CDOSYS on my host, but i dont know how to send email using that, the ASP Section of WWG has one but it is for CDONTS not for CDOSYS, any idea where can i get one ???
Thanks, take care
------------- http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..
|
Replies:
Posted By: MadDog
Date Posted: 22 June 2004 at 11:53pm
Just replace CDONTS with CDOSYS, heres a tutorial on CDOSYS, http://www.invisionportal.com/show_tutorial.asp?TutorialID=160 - http://www.invisionportal.com/show_tutorial.asp?TutorialID=1 60
------------- http://www.iportalx.net" rel="nofollow">
|
Posted By: neotrix
Date Posted: 23 June 2004 at 1:21pm
Thankyou
------------- http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..
|
Posted By: zMaestro
Date Posted: 25 June 2004 at 3:55pm
|
This include file may help, (I couldn't acess the page posted here)
Function sendemail(TOWHOM) SMTPServer = "SMTP.yourdomain.com"
FROM = " mailto:from@email.com - " TOWHO = " mailto:to@email.com - " RSBODY("Component") = What Component to use (read from database)
Select Case RSBODY("Component") Case "CDONTS" set mailObj = Server.CreateObject("CDONTS.NewMail") If (Request("Format") = "Text") Then mailObj.BodyFormat = 1 mailObj.MailFormat = 1 Else mailObj.BodyFormat = 0 mailObj.MailFormat = 0 End If mailObj.From = FROM mailObj.To = TOWHOM mailObj.Subject = TellSubject mailObj.Body = TellMessage If (Request("Importance") = "Low") Then mailObj.Importance= 0 ElseIf (Request("Importance") = "Normal") Then mailObj.Importance= 1 ElseIf (Request("Importance") = "High") Then mailObj.Importance= 2 Else mailObj.Importance= 2 End If mailObj.Send Case "ASPMail" Set mailObj = Server.CreateObject("SMTPsvg.Mailer") If (Request("Format") = "Text") Then mailObj.CharSet = 2 Else mailObj.ContentType = "text/html" End If mailObj.FromName = FROM mailObj.FromAddress= FROM mailObj.RemoteHost = SMTPServer mailObj.Subject = TellSubject mailObj.BodyText = TellMessage mailObj.AddRecipient TOWHOM mailObj.SendMail Case "ASPEmail" Set mailObj = Server.CreateObject("Persits.MailSender") mailObj.Host = SMTPServer mailObj.From = FROM mailObj.AddAddress = TOWHOM mailObj.Subject = TellSubject mailObj.Body = TellMessage If (Request("Format") = "Text") Then mailObj.IsHTML = False Else mailObj.IsHTML = True End If mailObj.Send Case "CDOSYS" Set mailObj = Server.CreateObject("CDO.Message") Set mailObjCon = Server.CreateObject ("CDO.Configuration") With mailObjCon .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer .Fieldshttp://schemas.microsof t.com/cdo/configuration/smtpconnectiontimeout(" http://schemas.microsoft.com/cdo/configuration/smtpserverpor t") = 25 .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Fields("") = 60 .Fields.Update End With Set mailObj.Configuration = mailObjCon With mailObj .From = FROM .To = TOWHOM .Subject = TellSubject .HTMLBody = TellMessage If NOT SMTPServer = "" Then .Send End with End Select End Function
|
|
Posted By: zaboss
Date Posted: 26 June 2004 at 1:46am
I would add several lines to CDOSYS to cover all possible situations:
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpserver") = "your smtp server"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpauthenticate")
= 1 'whether you use a authentication on the server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/sendusername") = "account name"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/sendpassword") = "account password"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/sendusing") = 2
'USER MUST HAVE CHANGE RIGHTS TO THE PICKUP DIRECTORY
'objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/con figuration/smtpserverpickupdirectory") = "c:\Inetpub\mailroot\Pickup"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpconnectiontimeout") = 60
|
------------- Cristian Banu
http://www.soft4web.ro - Soft 4 web
|
Posted By: neotrix
Date Posted: 26 June 2004 at 4:15am
|
I tried this
<%
Function sendemail() 'Dimension variables Dim objCDOSYSCon
'Create the e-mail server object Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Set and update fields properties With objCDOSYSCon 'Out going SMTP server .Fields("http://schemas.microsoft.com/cdo/configuratio n/smtpserver") = "127.0.0.1" 'SMTP port .Fields("http://schemas.microsoft.com/cdo/configuratio n/smtpserverport") = 25 'CDO Port .Fields("http://schemas.microsoft.com/cdo/configuratio n/sendusing") = 2 'Timeout .Fields("http://schemas.microsoft.com/cdo/configuratio n/smtpconnectiontimeout") = 60 .Fields.Update End With
'Update the CDOSYS Configuration Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSMail 'Who the e-mail is from .From = "waqas< mailto:mail@site.com - mail@site.com mailto:info@friendspoint.tk - >"
'Who the e-mail is sent to .To = "neo< mailto:tomail@site.com - tomail@site.com mailto:friendspoint@hotmail.com - >"
'The subject of the e-mail .Subject = "Mail Subject"
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) .HTMLBody = "<b>Bold</b<br><i>Italic</i><b r><u>Underline</u>"
'Send the e-mail If NOT strOutgoingMailServer = "" Then .Send End with
'Close the server mail object Set objCDOSYSMail = Nothing Response.Write("The Mail Was Sent")
End Function sendemail()
%>
|
This returns the message "The Mail Was Sent" as indicated in the function, gives no Error, but the mail is not sent 
I dont understand ? the mail server is working fine, everything is fine, with the same configration, web wiz forum easily sends mail, but this dosent work ? why ?
------------- http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..
|
Posted By: NISSANGTIR
Date Posted: 10 July 2004 at 4:42am
Hi - Ok I am sort of new to CDOSYS as I have just switched to Win2003  - I had mastered CDONTS but now I am rather stuck here too.
Below is a S I M P L E CDOSYS form that will work for you, just paste all the code in a page save it with an .asp extension and voila.... (Don't remember to put your e-mail address in >> objMail.To = "TYPE YOUR E-MAIL ADDRESS HERE"  )
<% Option Explicit %> <% 'Declare variables Dim sMsg Dim sFrom Dim sSubject Dim sTextBody
'Get data from previous page sFrom = Request("sFrom") sSubject = Request("sSubject") sTextBody = Request("sTextBody") 'Only run this if it's not the first time If Request.Form("Submit") <> "" Then Dim objMail 'Create the mail object Set objMail = Server.CreateObject("CDO.Message") 'Set key properties objMail.From = sFrom objMail.To = "TYPE YOUR E-MAIL ADDRESS HERE" objMail.Subject= sSubject objMail.TextBody = sTextBody
'Send the email objMail.Send 'Set sMsg which will be used later sMsg = "Thank You - Your message has been sent - http://www.LMWEBDESIGN.CO.UK - WWW.LMWEBDESIGN.CO.UK "
'Clean-up Set objMail = Nothing
End If %> <html> <head><title>SendMail</title></head> <body> <form action="<%=Request.ServerVariables("PATH_INFO")%>" method="post"> <table> <tr> <td>Send From:</td> <td><input type="text" name="sFrom" value="<%=sFrom%>"></td> </tr> <tr> <td>Message Subject:</td> <td><input type="text" name="sSubject" value="<%=sSubject%>"></td> </tr> <tr> <td>Message Text Body:</td> <td><textarea cols="60" rows="5" name="sTextBody"> <%=sTextBody%></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> <hr> <%=sMsg%> </form> </body> </html>
|
|
Posted By: NISSANGTIR
Date Posted: 10 July 2004 at 4:46am
Ok - Now I need someones help as I have given you all a free snippet 
The above only has simple From, Subject & Body fields, I need to get about 8 different fields to appear in the body but I don't know how to do this...ie. 
I want a form to ask - Age, Height, Weight, Country, Sex, Comments ...etc???
Any help would be VERY APPRECIATED 
|
Posted By: NISSANGTIR
Date Posted: 10 July 2004 at 6:21am
OK - it took me about an hour but I think I have mastered CDOSYS!! 
I must say, it really is much better than CDONTS!  WOW never thought I would have said that..lol 
I have created a FREE form for everyone to use on their website, it has all the usual fields! - It is all ready configured all you have to do is change the .... objMail.To = "TYPE YOUR E-MAIL ADDRESS HERE" to your e-mail address AND thats it 
http://www.lmwebdesign.co.uk/CDOSYS.zip - http://www.lmwebdesign.co.uk/CDOSYS.zip
Hope this helps everyone?
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 1:49pm
i have written the following code.
|
<%
'Integrated email 'Dimension variables Dim objCDOSYSCon Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpserver") = strSmtpServer objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/ configuration/smtpauthenticate") = 1 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendusername") = "mail@hootinanny.net" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendpassword") = "**********" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpserverport") = 25 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendusing") = 2 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpconnectiontimeout") = 60 objCDOSYSCon.Fields.Update Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = Request("from") objCDOSYSMail.To = "mail@hootinanny.net" objCDOSYSMail.Subject = Request("subject") objCDOSYSMail.TextBody = Request("message") If strSmtpServer <> "" Then objCDOSYSMail.Send Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing %>
|
|
which is the file send_mail.asp
and on the page layer_sx.asp, i have hard coded the following.
|
<% '************** SEND IDEAS **************
Sub Ideas() %> <% If Ublogtype = "open" Then If Not bLoggedIn Then %> <table align="center" width="90%"> <tr> <td class='sidetitle' align="left">IDEAS</td> </tr> <tr> <td align="center"> You must be logged in to use<br> this feature.<br> For security reasons,<br> please <a href="login.asp">Log In</a></td> </tr> </table> <% Else %> <table width="90%" align="center"> <tr> <td class='sidetitle' align="left">IDEAS</td> </tr> <tr> <td align="center"> <form method="post" action="include/send_mail.asp"> User: <INPUT type="hidden" name="from" value="<% = Session("UblogEmail")%>"> <% = Session("UblogEmail") %> <br /> Subject: <INPUT type="hidden" name="subject" value="User Submission">User Submission<br /> Message:<br> <TEXTAREA name="message" rows=10 cols=20></TEXTAREA><br /> <INPUT type="submit" value="Send" name="submit"> </form> </td> </tr> </table> <% End If End If %> <% End Sub %> |
|
When i submit this form, all i get is a blank page and no email. What am i missing?
|
Posted By: dpyers
Date Posted: 23 July 2004 at 2:13pm
|
I assume that the first file is named send_mail.asp and that it is in the include directory under the same directory where the second file is located.
Down at the end of the code for the first file, you say send the mail if the strSmtpServer isn't blank, but you never put anything into it.
Right after you do the Set statements in the first file, you'll have to put the mail server you're using into strSmtpServer - e.g. strSmtpServer = "mail.hootinanny.net" strSmtpServer = "smtp.hootinanny.net" strSmtpServer = "localhost" Your web host can tell you what server you're supposed to use.
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 2:24pm
|
DUH. I should have seen that. Thank you.
Okay, now i added that, and im getting this error.
error '80040211'
/include/send_mail.asp, line 25
|
Line 25 is the following.
If strSmtpServer <> "" Then objCDOSYSMail.Send
|
Should i take that If out?
|
Posted By: dpyers
Date Posted: 23 July 2004 at 2:27pm
Been There. Done That, Got a whole bunch of tee-shirts 
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 2:33pm
|
thats not exactly the answer i was looking for..
i took the if statement out and got the same error.
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 3:05pm
Posted By: dpyers
Date Posted: 23 July 2004 at 3:11pm
|
The if statement isn't the problem now. Now the problem is this statement... objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/ config uration/smtpserver") = strSmtpServer
Before you run that statement. you have to have strSmtpServer set to something.
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: dpyers
Date Posted: 23 July 2004 at 3:19pm
|
Your code should look like this...
<%
'Integrated email 'Dimension variables Dim objCDOSYSCon Dim strSmtpServer strSmtpServer ="XXXXXXXX" Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpserver") = strSmtpServer objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/ configuration/smtpauthenticate") = 1 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendusername") = "mail@hootinanny.net" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendpassword") = "**********" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpserverport") = 25 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/sendusing") = 2 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/config uration/smtpconnectiontimeout") = 60 objCDOSYSCon.Fields.Update Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = Request("from") objCDOSYSMail.To = "mail@hootinanny.net" objCDOSYSMail.Subject = Request("subject") objCDOSYSMail.TextBody = Request("message") If strSmtpServer <> "" Then objCDOSYSMail.Send Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing %> |
Where XXXXXXXX = your mail server. You might want to try just using localhost first as most web hosts support that. If it doesn't work, then you have to get the proper mail server to use from your web host.
EDIT: Just looked at your dns. If localhost doesn't work, try mail.hootinanny.net.
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 3:42pm
Posted By: daystoolate
Date Posted: 23 July 2004 at 3:51pm
|
Okay sir.
Here is what the code reads now.
<% 'Integrated email 'Dimension variables Dim objCDOSYSCon Dim strSmtpServer strSmtpServer ="mail.hootinanny.net" Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpserver - http://schemas.microsoft.com/cdo/configuration/smtpserver ") = strSmtpServer objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate - http://schemas.microsoft.com/cdo/configuration/smtpauthentic ate ") = 1 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendusername - http://schemas.microsoft.com/cdo/configuration/sendusername ") = " mailto:mail@hootinanny.net - mail@hootinanny.net " objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendpassword - http://schemas.microsoft.com/cdo/configuration/sendpassword ") = "**********" objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpserverport - http://schemas.microsoft.com/cdo/configuration/smtpserverpor t ") = 25 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendusing - http://schemas.microsoft.com/cdo/configuration/sendusing ") = 2 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout - http://schemas.microsoft.com/cdo/configuration/smtpconnectio ntimeout ") = 60 objCDOSYSCon.Fields.Update Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = Request("from") objCDOSYSMail.To = " mailto:mail@hootinanny.net - mail@hootinanny.net " objCDOSYSMail.Subject = Request("subject") objCDOSYSMail.TextBody = Request("message") If strSmtpServer <> "" Then objCDOSYSMail.Send Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing Response.Write("Message Sent") %>
|
and i am still getting this little error....
error '8004020e'
/include/send_mail.asp, line 26
|
Line 26 reads
Set objCDOSYSMail = Nothing
|
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 3:58pm
|
layer_sx.asp contains the form that submits to send_mail.asp
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 4:09pm
|
back to the same error...
error '8004020e'
/include/send_mail.asp, line 25
| with this code
<% 'Integrated email 'Dimension variables Dim objCDOSYSCon Dim strSmtpServer strSmtpServer ="mail.hootinanny.net" Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpserver - http://schemas.microsoft.com/cdo/configuration/smtpserver ") = strSmtpServer objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate - http://schemas.microsoft.com/cdo/configuration/smtpauthentic ate ") = 1 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendusername - http://schemas.microsoft.com/cdo/configuration/sendusername ") = " mailto:mail@hootinanny.net - mail@hootinanny.net " objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendpassword - http://schemas.microsoft.com/cdo/configuration/sendpassword ") = "**********" objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpserverport - http://schemas.microsoft.com/cdo/configuration/smtpserverpor t ") = 25 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/sendusing - http://schemas.microsoft.com/cdo/configuration/sendusing ") = 2 objCDOSYSCon.Fields(" http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout - http://schemas.microsoft.com/cdo/configuration/smtpconnectio ntimeout ") = 60 objCDOSYSCon.Fields.Update Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = Request("from") objCDOSYSMail.To = " mailto:mail@hootinanny.net - mail@hootinanny.net " objCDOSYSMail.Subject = Request("subject") objCDOSYSMail.TextBody = Request("message") If strSmtpServer <> "" Then objCDOSYSMail.Send Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing Response.Write("Message Sent") %>
|
|
Posted By: dpyers
Date Posted: 23 July 2004 at 4:14pm
|
Founf this reference to the eror message http://www.aspfaq.com/show.asp?id=2026 - http://www.aspfaq.com/show.asp?id=2026 If you search on that page for 8004020e, it says...
"If you get "8004020E" or "80040211" errors, and you are using a remote SMTP server, make sure that the web server can ping the SMTP server, and that the server is configured to allow SMTP relay, and that it doesn't require outgoing SMTP authentication. If it does, you may need to use the commercial version of http://www.aspemail.com/ - ASPEmail , or another component that supports outgoing SMTP authentication. You can send e-mail to an SMTP server requiring outgoing authentication with CDO using the following code: " ... "You might also check that your SMTP server isn't restricted to a certain set of domain names in the recipients or senders lists (depending on what your SMTP software supports) and that the correct ports are open if there is a firewall or router sitting between your web server and the mail server."
Basically, it tosses the ball into your web host's court. They need to tell you the explicit server to use, if it requires authentication, and if it has any restrictions on who it can send to or any firewall/router blocking.
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: daystoolate
Date Posted: 23 July 2004 at 4:22pm
|
you were right. I changed the "from" tag to the mailto:mail@hootinanny.net - mail@hootinanny.net address and it workd
thanks
|
Posted By: dpyers
Date Posted: 23 July 2004 at 4:27pm
Just hate it when it's something like that! 
-------------
Lead me not into temptation... I know the short cut, follow me.
|
|