FromAddr Property


Value of "From" header (message sender).

To deal with e-mail addresses with international domain names (IDN), use EscapeIdnDomain method to encode an e-mail address to IDN form (when sending out e-mails) or UnescapeIdnDomain method to decode an e-mail address into human-readable form (when receiving e-mails).

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.


Value Type: String
Parameters: None 

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-2022, AfterLogic Corporation. All rights reserved.