Big rock classic asp mail sent script

A blast from the past!

Here is an example of a classic ASP script that sends an email using the Mail object:

<%
' Set the email server settings
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")

objMail.From = "[email protected]"
objMail.To = "[email protected]"
objMail.Subject = "Test Email"
objMail.BodyPart.Charset = "UTF-8"
objMail.TextBody = "This is a test email sent using classic ASP"

' Set the email server settings
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your_smtp_server"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Update

' Send the email
objMail.Send

' Clean up
Set objMail = Nothing
%>

Let me explain what's going on:

  1. We create a CDO.Message object using the Server.CreateObject method.
  2. We set the email server settings using the Configuration object. In this example, we're using a simple SMTP server with port 25.
  3. We set the From, To, Subject, and Body properties of the email.
  4. We call the Send method to send the email.
  5. Finally, we clean up by setting the objMail object to Nothing.

Note that this script uses the CDO (Collaboration Data Objects) component, which is a legacy technology that was widely used in the early days of ASP. While it's still supported in modern browsers, it's not recommended for new development due to security concerns and limitations.

If you're looking for a more modern and secure way to send emails from ASP, you may want to consider using a third-party library or service, such as SendGrid or Mailgun.