|
Creating an EmailMessage message |
|
To address an email message construct a new EmailMessage instance providing the To: address and From: address to the constructor. Alternatively, you may assign the To and From properties on the EmailMessage instance if you are using the default US-ASCII character set encoding. Otherwise, use the SetTo and SetFrom methods.
The EmailMessage class also has properties and methods for adding carbon-copy and blind-carbon-copy recipients. Multiple email recipients must be separated by a comma. If the To, From or Cc headers contain non US-ASCII character data then see Sending an Email message for languages other than English.
Example 1
[C#]
EmailMessage message = new EmailMessage("jsmith@myserver.com", "mjones@yourserver.com");
[Visual Basic]
Dim message As EmailMessage = Nothing
message = New EmailMessage("jsmith@myserver.com", "mjones@yourserver.com")
Example 2
[C#]
EmailMessage message = new EmailMessage("jsmith@myserver.com", "mjones@yourserver.com");
// adds carbon-copy recipients
message.Cc = "carol@myserver.com,bjacks@myserver.com";
// add blind-carbon-copy recipient
message.Bcc = "ron@myserver.com";
[Visual Basic]
Dim message As EmailMessage = Nothing
message = New EmailMessage("jsmith@myserver.com", "mjones@yourserver.com")
' adds carbon-copy recipients
message.Cc = "carol@myserver.com",bjacks@myserver.com"
' add blind-carbon-copy recipient
message.Bcc = "ron@myserver.com"
See also