crmpicco
04-11-2006, 10:48 AM
<%
sBodyText = vbNullString
sBodyText = sBodyText & "<html>"
sBodyText = sBodyText & "<body>"
sBodyText = sBodyText & "<table width=""600px"" border=""1"" bordercolor=""#000000"">"
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bgcolor=""#999999"">"
sBodyText = sBodyText & "Email Correspondance from picco.co.uk"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display the Name of sender
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Name: <strong>" & sName & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display the Company (if applicable) of sender
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Company: <strong>" & sCompany & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display Email Address
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Email Address: <strong>"
sBodyText = sBodyText & "<a href=""mailto:"&sEmail&""">"
sBodyText = sBodyText & sEmail & "</a></strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display Date and Time Email was sent
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Sent: <strong>" & FormatDateTime(date(),vbLongDate) & " at " & FormatDateTime(now(),vbShortTime) & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF""><hr /></td>"
sBodyText = sBodyText & "</tr>"
'... Display the Message sent
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"&sMessage&"</td>"
sBodyText = sBodyText & "</tr>"
sBodyText = sBodyText & "</table>"
sBodyText = sBodyText & "</body>"
sBodyText = sBodyText & "</html>"
'... clear all current variables being used
sName = vbNullString
sCompany = vbNullString
sEmail = vbNullString
sMessage = vbNullString
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Email Correspondance on "& FormatDateTime(date(),vblongdate) & " at " & FormatDateTime(now(),vbshorttime)
myMail.From="info@picco.co.uk"
myMail.To="cmorton@piccoro.co.uk"
myMail.HTMLBody=sBodyText '... the email message
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="smtp.picco.co.uk"
'Server Password
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") _
="piccoltd"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
sBodyText = vbNullString
Set myMail = Nothing
%>
this is my code to send an email in Classic ASP, how can i prevent an Email Injection Attack?
Picco
sBodyText = vbNullString
sBodyText = sBodyText & "<html>"
sBodyText = sBodyText & "<body>"
sBodyText = sBodyText & "<table width=""600px"" border=""1"" bordercolor=""#000000"">"
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bgcolor=""#999999"">"
sBodyText = sBodyText & "Email Correspondance from picco.co.uk"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display the Name of sender
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Name: <strong>" & sName & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display the Company (if applicable) of sender
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Company: <strong>" & sCompany & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display Email Address
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Email Address: <strong>"
sBodyText = sBodyText & "<a href=""mailto:"&sEmail&""">"
sBodyText = sBodyText & sEmail & "</a></strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
'... Display Date and Time Email was sent
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"
sBodyText = sBodyText & "Sent: <strong>" & FormatDateTime(date(),vbLongDate) & " at " & FormatDateTime(now(),vbShortTime) & "</strong>"
sBodyText = sBodyText & "</td>"
sBodyText = sBodyText & "</tr>"
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF""><hr /></td>"
sBodyText = sBodyText & "</tr>"
'... Display the Message sent
sBodyText = sBodyText & "<tr>"
sBodyText = sBodyText & "<td bordercolor=""#FFFFFF"">"&sMessage&"</td>"
sBodyText = sBodyText & "</tr>"
sBodyText = sBodyText & "</table>"
sBodyText = sBodyText & "</body>"
sBodyText = sBodyText & "</html>"
'... clear all current variables being used
sName = vbNullString
sCompany = vbNullString
sEmail = vbNullString
sMessage = vbNullString
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Email Correspondance on "& FormatDateTime(date(),vblongdate) & " at " & FormatDateTime(now(),vbshorttime)
myMail.From="info@picco.co.uk"
myMail.To="cmorton@piccoro.co.uk"
myMail.HTMLBody=sBodyText '... the email message
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="smtp.picco.co.uk"
'Server Password
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") _
="piccoltd"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
sBodyText = vbNullString
Set myMail = Nothing
%>
this is my code to send an email in Classic ASP, how can i prevent an Email Injection Attack?
Picco