DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Search Directory
ASP Directory
Xml Directory

Setting the Reply-To Header in an Email using CDONTS.NewMail Object

Author: Asif

This Sample code will help you understand how to set the Reply-To Header in an email using CDONTS.NewMail object in an ASP Page.

Option Explicit

Dim objMail
Dim strSubject
Dim strBody

strSubject = "This is a test email"
strBody    = "This test email is using " & _
           " as the sender email address but we are " & _
           " using as the Reply-To header."

' First create an instance of NewMail Object
Set objMail = Server.CreateObject("CDONTS.NewMail")

' Please replace the "From" and "To" email addresses with your
' own valid email address. I recieve too many emails
' from people who test this sample and keep sending
' emails to, or they keep the "From" property
' as and I get response of
' undeliverable emails.
' NOTE: If the "To" or "From" properties of CDONTS contain
' invalid email address you will not recieve the email.
objMail.From = ""
objMail.To   = ""

' Use the value property of the CDONTS.NewMail Object
' to Set the Reply-To header

objMail.Value("Reply-To") = ""

objMail.Subject = strSubject
objMail.Body    = strBody


Set objMail = Nothing
Disclaimer - Privacy
© 2002-2015