aspNetEmail

EmailMessage.From Property

The 'FROM' address (and name) of the sender

public string From {get; set;}

Remarks

This property will override the values of FromAddress and FromName. It can be used for setting a FROM address like "Tom <tom@example.com>", and the value address will be parsed into the respective Name and Address. These parts will populate the .FromAddress and .FromName properties. If no 'Name' part of the value is found, only the .FromAddress property will be populated.

If a MailMerge (##) value is used, it is assumed this is for the .FromAddress value. To populate the FromName during a mail merge process, use the .FromName property.

Example

[C#]
            EmailMessage msg = new EmailMessage( "mail.myCompany.com");
            msg.Subject = "Order Confirmation";
            msg.To = "you@yourcompany.com";
            
            //the .From property can be used to parse complex addresses into the address and name part
            msg.From = "\"Steve James\" <me@myCompany.com>";
            
            //logging for easier troubleshooting
            msg.Logging = true;
            msg.LogPath = "c:\\email.log";
            msg.LogDebugStatements = true;
            
            //set the plain text body
            msg.Body  = "the email body contents go here...";
            
            msg.Send();
            
            
[VB.NET]
            
            Dim msg As New EmailMessage("mail.myCompany.com")
            msg.Subject = "Order Confirmation"
            msg.To = "you@yourcompany.com"
            
            'the .From property can be used to parse complex addresses into the address and name part
            msg.From = """Steve James"" <me@myCompany.com>"
            
            'logging for easier troubleshooting
            msg.Logging = True
            msg.LogPath = "c:\email.log"
            msg.LogDebugStatements = True
            
            'set the plain text body
            msg.Body = "the email body contents go here..."
            
            msg.Send()
            
            

See Also

EmailMessage Class | aspNetEmail Namespace