Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Asp Email in ASP

Asp Email in ASP

Sending email from Classic ASP can be done using the built-in CDO.Message object, which leverages the Collaboration Data Objects (CDO) to send SMTP emails.


How to Send Email in Classic ASP

Simple Example using CDO.Message

<%Dim objEmailSet objEmail = Server.CreateObject("CDO.Message")' Set email propertiesobjEmail.From = "sender@example.com"objEmail.To = "recipient@example.com"objEmail.Subject = "Test Email from Classic ASP"objEmail.TextBody = "Hello! This is a test email sent from Classic ASP."' Configure SMTP serverobjEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' cdoSendUsingPortobjEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.yourserver.com"objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25' Optional: If SMTP server requires authentication' objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1' objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "your_username"' objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "your_password"objEmail.Configuration.Fields.Update' Send the emailobjEmail.SendSet objEmail = NothingResponse.Write "Email sent successfully!"%>

Explanation:

Property/FieldPurpose
FromSender’s email address
ToRecipient’s email address
SubjectSubject of the email
TextBodyEmail body (plain text)
smtpserverYour SMTP server (e.g., smtp.gmail.com)
smtpserverportSMTP port (usually 25, 465, or 587)
smtpauthenticateSet to 1 if SMTP requires authentication
sendusername and sendpasswordCredentials for SMTP authentication

Notes:

  • Make sure your SMTP server allows relay from your web server.

  • If using Gmail or other providers, you may need to configure SSL and ports accordingly (advanced setup).

  • You can also send HTML email by using .HTMLBody instead of .TextBody.


Example: Sending HTML Email

objEmail.HTMLBody = "<h1>Welcome!</h1><p>This is an <b>HTML</b> email.</p>"

Want help with:

  • Sending email with attachments?

  • Sending email via Gmail SMTP with SSL?

  • Handling errors when sending email?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql