Adding custom headers

Visual Basic Code | ASP Code

The sample sends plain-text e-mail with "Organization:" field set in the headers.

SMTP.AddHeader is a key method of the sample.

For simplicity, SMTP authentication is not used and no error-checking is performed.

[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 = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Hi"
objSMTP.BodyText = "This is test message with custom headers"

' Add "Organization" header
objSMTP.AddHeader "Organization", "Corporation, Inc."

' Send it!
objSMTP.Send

[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 with custom headers"

' Add "Organization" header
objSMTP.AddHeader "Organization", "Corporation, Inc."

' Send it!
objSMTP.Send
%>
See Also:
AddAttachment Method

 


Send feedback to AfterLogic
Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.