Author |
Topic Search Topic Options
|
neotrix
Mod Builder Group
Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
|
Post Options
Thanks(0)
Quote Reply
Topic: CDOSYS Mail Form ? Anyone ?!? 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
|
|
|
MadDog
Mod Builder Group
Joined: 01 January 2002
Status: Offline
Points: 3009
|
Post Options
Thanks(0)
Quote Reply
Posted: 22 June 2004 at 11:53pm |
|
|
|
neotrix
Mod Builder Group
Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
|
Post Options
Thanks(0)
Quote Reply
Posted: 23 June 2004 at 1:21pm |
Thankyou
|
|
|
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
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 = "from@email.com" TOWHO = "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
|
|
|
zaboss
Senior Member
Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
|
Post Options
Thanks(0)
Quote Reply
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
|
|
|
|
neotrix
Mod Builder Group
Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
|
Post Options
Thanks(0)
Quote Reply
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<mail@site.com>"
'Who the e-mail is sent to .To = "neo<tomail@site.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 ?
Edited by neotrix
|
|
|
NISSANGTIR
Groupie
Joined: 20 April 2004
Location: United Kingdom
Status: Offline
Points: 85
|
Post Options
Thanks(0)
Quote Reply
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 - 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>
|
|
|
NISSANGTIR
Groupie
Joined: 20 April 2004
Location: United Kingdom
Status: Offline
Points: 85
|
Post Options
Thanks(0)
Quote Reply
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
|
|