Asp email example

Here is an example of an ASP (Active Server Pages) email script:

<%
' Set the email recipient and subject
strRecipient = "[email protected]"
strSubject = "Test Email from ASP"

' Set the email body
strBody = "This is a test email sent from an ASP page."

' Create a new email object
Set objEmail = Server.CreateObject("CDO.Message")

' Set the email properties
objEmail.From = "[email protected]"
objEmail.To = strRecipient
objEmail.Subject = strSubject
objEmail.TextBody = strBody

' Send the email
objEmail.Send

' Clean up
Set objEmail = Nothing
%>

This script uses the CDO (Collaboration Data Objects) component to send an email. The script sets the recipient, subject, and body of the email, and then sends it using the Send method.

You can also use other email components such as CDONTS (Collaboration Data Objects for NT Services) or ASPMail to send emails.

Here is an example of using CDONTS:

<%
' Set the email recipient and subject
strRecipient = "[email protected]"
strSubject = "Test Email from ASP"

' Set the email body
strBody = "This is a test email sent from an ASP page."

' Create a new email object
Set objEmail = Server.CreateObject("CDONTS.NewMail")

' Set the email properties
objEmail.From = "[email protected]"
objEmail.To = strRecipient
objEmail.Subject = strSubject
objEmail.Body = strBody

' Send the email
objEmail.Send

' Clean up
Set objEmail = Nothing
%>

And here is an example of using ASPMail:

<%
' Set the email recipient and subject
strRecipient = "[email protected]"
strSubject = "Test Email from ASP"

' Set the email body
strBody = "This is a test email sent from an ASP page."

' Create a new email object
Set objEmail = Server.CreateObject("ASPMail.NewMail")

' Set the email properties
objEmail.From = "[email protected]"
objEmail.To = strRecipient
objEmail.Subject = strSubject
objEmail.Body = strBody

' Send the email
objEmail.Send

' Clean up
Set objEmail = Nothing
%>

Note that these examples are just a starting point, and you will likely need to modify them to fit your specific needs. Additionally, you may need to configure your server to allow ASP pages to send emails.