<%
Set myMail=CreateObject("CDO.Message")
if Request("subject") <> "" then
myMail.Subject=Request("subject")
else
myMail.Subject="<Subject>"
end if
if Request("from") <> "" then
myMail.From=Request("from")
else
myMail.From="<From Email Address>"
end if
if Request("To") <> "" then
myMail.To=Request("To")
else
myMail.To="<To Email Address>"
end if
if Request("Cc") <> "" then
myMail.CC=Request("Cc")
else
myMail.CC="<CC Email Address>"
end if
myMail.TextBody= request("body")
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'SMTP server
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<SMTP Server>"
'SMTP port
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
On Error Resume Next
myMail.Send
If Err <> 0 Then
Response.Write "An error occurred: " & Err.Description
else
Response.Write("<b>")
Response.Write("Email sent to " & request("to") & " from " & request("from"))
Response.Write("<br><br>")
End If
set myMail=nothing
%>
Originally Posted on March 3, 2014
Last Updated on May 25, 2017
Last Updated on May 25, 2017
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.