SMTP Authentication
The sample sends simple e-mail using SMTP authentication.
Many mail servers allow sending e-mails from authenticated users only. To authenticate, you need to specify your user account name, the password and the authentication method.
Authentication methods can be of two types: secure (password is transmitted to the server in secure format) and insecure (password is transmitted as plain-text). Many SMTP servers support insecure methods only.
SMTP object supports several authentication methods (both secure and insecure) through AuthMethod property. Some of them may be not supported by particular SMTP server.
Dim objSMTP, strTemp
' 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"
' Use LOGIN Authentication method (insecure, but
' supported by nearly all SMTP servers)
objSMTP.AuthMethod = 2
' Set authentication credentials
objSMTP.UserName = "jdoe"
objSMTP.Password = "secret"
' Set message properties
objSMTP.FromAddr = "sender@firstdomain.com"
objSMTP.ToAddr = "recipient@seconddomain.com"
objSMTP.Subject = "Test"
objSMTP.BodyText = "Body of the test message"
' Try to send message
If objSMTP.Send Then
MsgBox "Sent successfully"
Else
MsgBox "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc
End If
<%
Dim objSMTP, strTemp
' 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"
' Use LOGIN Authentication method (insecure, but
' supported by nearly all SMTP servers)
objSMTP.AuthMethod = 2
' Set authentication credentials
objSMTP.UserName = "jdoe"
objSMTP.Password = "secret"
' Set message properties
objSMTP.FromAddr = "sender@firstdomain.com"
objSMTP.ToAddr = "recipient@seconddomain.com"
objSMTP.Subject = "Test"
objSMTP.BodyText = "Body of the test message"
' Try to send message
If objSMTP.Send Then
Response.Write "Sent successfully"
Else
Response.Write "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc
End If
%>
See Also:
AuthMethod Property