SendEx Method
Sends the message to SMTP server. In addition
to standard sending functionality, it allows sending messages from fake addresses
(From header is ignored) to addresses different from those specified in To/CC/BCC
headers.
When used without parameters, this method behaves identically to Send
method.
Note: You may use this method for messages blind-forwarding
(i.e. resending messages wihout any modifications).
blnResult = ObjectName.SendEx([FromAddr], [Recips]) |
Parameters: | ||
FromAddr As String | (optional) If specified, overrides SMTP.Message.FromAddr setting. This may be used if you want to send email from address different from those specified in From header (sending from fake address) | |
Recips As String | (optional) If specified, overrides SMTP.Message.ToAddr/CCAddr/BCCAddr setting. This may be used if you want to send email to addresses different from those specified in To/CC/BCC headers | |
Return value As Boolean | True if successful, False otherwise. Note, that if error occurred because SMTP server rejected the message (wrong sender, recipient, message too large, etc.), Send method returns False but no automatic Disconnect occurs (so you can fix the problem and resend the message over the same connection) | |
Remarks: | Some servers do not allow email address overriding (sending from fake address). However, if you are sending from real (not fake) address but this address is different from those specified in From header, you may try to add Resent-From header to the message (see example below) |
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" If Mailer.Connect Then Mailer.Message.ToAddr = "bill@yoursite.com" Mailer.Message.FromAddr = "joe@mysite.com" Mailer.Message.AddHeader "Resent-From", "myrealaddress@myownsite.com" Mailer.Message.Subject = "Hello" Mailer.Message.ImportBodyText "C:\docs\letter.htm", True If Not Mailer.SendEx("myrealaddress@myownsite.com", _ "George Jones<george@abc.com>") Then MsgBox Mailer.ErrDesc Mailer.Disconnect End If
See Also:
"Creating
and sending HTML-formatted messages" Tutorial
Connect Method
Send Method
SendToQueue Method
RelayMessage Method
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.