FromAddr Property
Value of "From" header (message sender).
If the message was received using MailBee.POP3 object, the property is
value of "From" header or empty string if this header is missing.
If composing the message (for usage with MailBee.SMTP object), FromAddr
must be set to the moment of calling Send method. Otherwise, SMTP server
will reject the message.
Note: (for usage with SMTP) Most SMTP servers ignore
value of HELO/EHLO command argument, but if you have troubles while connecting
to SMTP server, you might consider this note valueable. Domain part of FromAddr
(i.e. "server.com" of email address "user@server.com") can
be used as a parameter of SMTP HELO/EHLO command (which is executed by SMTP.Connect
method). If you want such behavior, set FromAddr BEFORE calling SMTP.Connect
method. Otherwise (if FromAddr is empty to the moment of calling SMTP.Connect)
host name of the machine running MailBee will be used as HELO/EHLO command argument.
Also, you might specify SMTP.Domain property to explicitly specify HELO/EHLO
command argument.
| Value Type: | String | |
| Parameters: | None | |
| Remarks: | If the message was received using MailBee.POP3 object, you cannot change this property unless Message.Locked property is set to False | |
Usage example:
' Example 1: Using with POP3 object Dim Mailer, Msg 'Using visual basic to create object Set Mailer = CreateObject("MailBee.POP3") 'Using ASP to create object 'Set Mailer = Server.CreateObject("MailBee.POP3") 'In ASP use Response.Write instead of MsgBox Mailer.LicenseKey = "put your license key here" Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword" If Mailer.Connected Then If Mailer.MessageCount > 0 Then Set Msg = Mailer.RetrieveSingleMessage(1) If Not Msg Is Nothing Then MsgBox "From: " & Msg.FromAddr End If Mailer.Disconnect End If ' Example 2: Using with SMTP object ' (Connect method will authenticate using 'HELO mysite.com' taken from FromAddr). 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" 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 Mailer.Connect Then Mailer.Send Mailer.Disconnect Else MsgBox Mailer.ErrDesc End If ' Example 3: Using with SMTP object ' (Connect method will authenticate using 'HELO localhost' if it's hostname of your machine). 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" ' FromAddr is empty at this time, the machine's hostname is used 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 Mailer.Send Mailer.Disconnect Else MsgBox Mailer.ErrDesc End If
See Also:
PureFromAddr
Property
FromFriendlyName Property
ToAddr Property
CCAddr Property
BCCAddr Property
SMTP.Domain Property
SMTP.Connect Method
Copyright 2002-2008, AfterLogic Corporation. All rights reserved.