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

FREE 12 month online training for ASP.NET & MS Expression Studio and a Free copy of MS Expression Web with Windows Server Purchase
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 test@devasp.com " & _
           " as the sender email address but we are " & _
           " using someone@devasp.com 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 test@devasp.com, or they keep the "From" property
' as webmaster@devasp.com 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 = "test@devasp.com"
objMail.To   = "webmaster@devasp.com"

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

objMail.Value("Reply-To") = "someone@devasp.com"

objMail.Subject = strSubject
objMail.Body    = strBody

objMail.Send

Set objMail = Nothing
%>
Disclaimer - Privacy
© 2002-2014 DevASP.com