Below is a sample ASP script that uses the ASPMail component to send an unauthenticated (no username or password required) test e-mail. To use the sample script:
<%
'-----EDIT THE MAILING DETAILS IN THIS SECTION-----
dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo
fromName = "Test ASP Script"
fromAddress = "address@domain.com"
recipientName = "Your Name Goes Here"
recipientAddress= "yourEmailAddress@yourDomain.com"
subject = "Enter a Subject Title Here!"
body = "Enter the Body of the Mailing Here!"
'-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----
sentTo = "NOBODY"
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = fromName
Mailer.FromAddress = fromAddress
Mailer.RemoteHost = "mrelay.perfora.net"
if Mailer.AddRecipient (recipientName, recipientAddress) then
sentTo=recipientName & " (" & recipientAddress & ")"
end if
Mailer.Subject = subject
Mailer.BodyText = body
if Mailer.SendMail then
Response.Write "The mailing was sent to: <b>" & sentTo & "</b>"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
If you are proficient enough to manipulate the code above, it is also possible to then add additional parameters to the mailing such as attachments, CCs, etc:
Mailer.AddAttachment Server.MapPath("somefile.doc")
OR IF IN A SUBFOLDER
Mailer.AddAttachment Server.MapPath("subfolder/somefile.doc")
Mailer.AddCC "Susan Smith", "susan.smith@domain.com"
Mailer.AddBCC "John Smith", "john.smith@domain.com"
Mailer.GetBodyTextFromFile Server.MapPath("welcomeMail.txt"), True,False
OR IF IN A SUBFOLDER
Mailer.GetBodyTextFromFile Server.MapPath("subfolder/welcomeMail.txt"), True,False