Send Method


Sends the message to SMTP server.

To send from fake address, use SendEx method. Sending from fake address commonly used in group mailings to make sure bounce mails are all arrive to the same address.

Note: Many SMTP servers require user authentication in order to send emails. See AuthMethod property reference for details. Sample code below uses authentication. If it is not required or not supported by your server, comment corresponding lines or just set AuthMethod=0.


blnResult = ObjectName.Send  
Parameters: None 
Return value As Boolean True if successful, False otherwise  

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mail.server.com"

' Comment next 3 lines if authentication is not required.
Mailer.AuthMethod = 1 ' Using PLAIN authentication
Mailer.UserName = "MyUserName" ' Mail account name
Mailer.Password = "MyPassword" ' Mail account password

If Mailer.Connect Then
  Mailer.Message.ToAddr = "bill@yoursite.com"
  Mailer.Message.FromAddr = "joe@mysite.com"
  Mailer.Message.Subject = "Hello"
  Mailer.Message.ImportBodyText "C:\docs\letter.htm", True
  If Not Mailer.Send Then MsgBox Mailer.ErrDesc
  Mailer.Disconnect
End If

See Also:

"Creating and sending HTML-formatted messages" Tutorial

Connect Method
SendEx Method
SendToQueue Method
RelayMessage Method


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.