Sunday, September 18, 2011

Post subject FormMail on Windows server using


//** FormMail on Windows server using 'cdosys' **// :-

----------------------------------------------------------------------

This is a cdosys script same as FormMail script on Linux server. Simply create a file by the name cdosyseg.asp and paste the below given contents in to it. Only make changes to the following fields 

oMail.To = "email id" 
oMail.From = "email id" 
oMail.Subject = "This is a test email from cdosys script" 

Note >>: 'cdonts' doesn't work on Windows 2003 server, you have to use cdosys instead. 


cdosyseg.asp 

*******************-------------------*************************
<% 
dim HTML,AdvisorFirstName,AdvisorLastName 
HTML = HTML & " <html><body>" 
HTML = HTML & " <table border=""0"">" 
HTML = HTML & " <tr>" 
HTML = HTML & " <th bgcolor=""#B0CDDD"">" 
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2""> <b> Advisor First Name: </b> </font> </p>" 
HTML = HTML & " </th>" 
HTML = HTML & " <td bgcolor=""#B0CDDD"">" 
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2"">" & Request("AdvisorFirstName") & "</p>" 
HTML = HTML & " </td>" 
HTML = HTML & " </tr>" 
HTML = HTML & " <tr>" 
HTML = HTML & " <th bgcolor=""#B0CDDD"">" 
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2""> <b> Advisor Last Name: </b> </font> </p>" 
HTML = HTML & " </th>" 
HTML = HTML & " <td bgcolor=""#B0CDDD"">" 
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2"">" & Request("AdvisorLastName") & "</p>" 
HTML = HTML & " </td>" 
HTML = HTML & " </tr>" 
HTML = HTML & " </table>" 
HTML = HTML & "<br>" 
HTML = HTML & " </body></html>" 

'CDOSYS Configuration 
Set oMail = Server.CreateObject("CDO.Message") 
Set iConf = Server.CreateObject("CDO.Configuration") 
Set Flds = iConf.Fields 

'Default parameters for Dataflame (dont change) 
'Note 
'Use "localhost" If mail is routed from same server. 
'Use Server IP like "203.90.78.221" if Domain has MX record having IP "203.90.78.221" OR Mails are routed from that IP 

iConf.Fields.Update 
Set oMail.Configuration = iConf 
oMail.From = "supernova_57@hotmail.com
oMail.Subject = "New Email!" 

'If message body is in HTML FORMAT 
oMail.BodyPart.ContentTransferEncoding = "quoted-printable" 
oMail.HTMLBody = HTML 
oMail.Send 
Set iConf = Nothing 
Set Flds = Nothing 
%> 
<html> 
Message Sent 
</html> 

*******************-------------------*************************

end of cdosyseg.asp 


Below is test form, which you can simply copy to a file and rename it as test.html. 
You can have the clients form to use the same cdosys script by simply including the cdosys sript path on the action part. Just as :- 

<FORM METHOD="POST" action="cdosyseg.asp" onSubmit="" name="Online Registration"> 


test.html 

*******************-------------------*************************

<!-- saved from url=(0022)http://internet.e-mail --> 
<FORM METHOD="POST" action="cdosyseg.asp" onSubmit="" name="Online Registration"> 
<P> 
Please provide the following contact information:</P> 
<BLOCKQUOTE> 
<TABLE> 
<TR> 
<TD ALIGN="right"> 
<EM><font face="Arial Black">First Name</font></EM></TD> 
<TD> 
<font face="Arial Black"> 
<INPUT NAME="AdvisorFirstName" SIZE=53> 
</font> 
</TD> 
</TR> 
<TR> 
<TD ALIGN="right"> 
<EM><font face="Arial Black"> Last Name</font></EM></TD> 
<TD> 
<font face="Arial Black"> 
<INPUT NAME="AdvisorLastName" SIZE=53> 
</font> 
</TD> 
</TR> 
</TABLE> 
<input type="submit" name ="SUBMIT" value="SUBMIT" > 
</form>

*******************-------------------*************************

No comments:

Post a Comment