Bounced messages: SMTP part

The sample sends e-mail so as possible delivery errors would come to special e-mail address.

When the e-mail cannot be delivered, bounced e-mail is sent to the original sender. However, it is often more convenient to have bounced e-mails arrived to single mailbox which is specially dedicated to bounce e-mails.

The sample code makes bounce e-mails to arrive to dedicated address (which can be different from "From:" address) using SMTP.SendEx method.

Note: Some SMTP servers do not allow sending e-mail from address different from specified in "From:" header.

Demonstration of processing bounced e-mail themselves is shown in POP3 part of the sample.

Visual Basic

Dim objSMTP

' Create mailer component
Set objSMTP = CreateObject("MailBee.SMTP")

' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"

' Set SMTP server name
objSMTP.ServerName = "mail.server.com"

' Set message properties
objSMTP.FromAddr = "joe@domain1.com"
objSMTP.ToAddr = "bill@domain2.com"
objSMTP.Subject = "Hi"
objSMTP.BodyText = "This is test message"

' Send e-mail. If it cannot be delivered, bounce will
' arrive to bounce@domain3.com, not to joe@domain1.com
objSMTP.SendEx "bounce@domain3.com"

ASP

<%
Dim objSMTP

' Create mailer component
Set objSMTP = Server.CreateObject("MailBee.SMTP")

' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"

' Set SMTP server name
objSMTP.ServerName = "mail.server.com"

' Set message properties
objSMTP.FromAddr = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Hi"
objSMTP.BodyText = "This is test message"

' Send e-mail. If it cannot be delivered, bounce will
' arrive to bounce@domain3.com, not to joe@domain1.com
objSMTP.SendEx "bounce@domain3.com"
%>

See Also:

Bounced messages: POP3 part

SMTP.SendEx Method