UTMail  1.1
Email Composition and Sending Plugin
Public Member Functions | Properties | List of all members
UT.MailMessage Class Reference

Describes an email message to be composed or sent directly. More...

Inheritance diagram for UT.MailMessage:

Public Member Functions

 MailMessage ()
 Initializes a new instance of the UT.MailMessage class. More...
 
 MailMessage (MailMessage mailMessage)
 Initializes a new instance of the UT.MailMessage class. More...
 
MailMessage AddTo (string emailAddress)
 Adds "To" recipient. More...
 
MailMessage AddCC (string emailAddress)
 Adds "Cc" recipient ("send as copy"). More...
 
MailMessage AddBcc (string emailAddress)
 Adds "Bcc" recipient ("send as hidden copy"). More...
 
MailMessage SetSubject (string subject)
 Sets the email message subject. More...
 
MailMessage SetBody (string body)
 Sets the email message body. More...
 
MailMessage SetBodyHtml (bool isBodyHtml)
 Specifies whether Body should be interpreted as HTML. More...
 
MailMessage AddAttachment (string attachmentPath)
 Adds an attachment from a file specified by full path. More...
 
MailMessage AddAttachment (global::System.IO.Stream stream, string fileName)
 Adds an attachment from System.IO.Stream. More...
 
MailMessage AddAttachment (byte[] byteBuffer, string fileName)
 Adds an attachment from a byte buffer, i.e. byte[]. More...
 
MailMessage AddAttachment (string text, global::System.Text.Encoding targetEncoding, string fileName)
 Adds an attachment from text. More...
 
MailMessage AddAttachment (string text, string fileName)
 Adds an attachment from text. More...
 

Properties

new MailAddressCollection To [get]
 A collection of "To" recipients. More...
 
new MailAddressCollection CC [get]
 A collection of "To" recipients. More...
 
new MailAddressCollection Bcc [get]
 A collection of "To" recipients. More...
 
new string Subject [get, set]
 Gets or sets email message subject. More...
 
new string Body [get, set]
 Gets or sets email message body. More...
 
new bool IsBodyHtml [get, set]
 Specifies whether Body should be interpreted as HTML. More...
 
new AttachmentCollection Attachments [get]
 A collection of all attachments. More...
 

Detailed Description

Describes an email message to be composed or sent directly.

Implements IDisposable, so you have to either call Dispose() or wrap MailMessages with using. F.e., see UTMailSample.

Constructor & Destructor Documentation

◆ MailMessage() [1/2]

UT.MailMessage.MailMessage ( )

Initializes a new instance of the UT.MailMessage class.

◆ MailMessage() [2/2]

UT.MailMessage.MailMessage ( MailMessage  mailMessage)

Initializes a new instance of the UT.MailMessage class.

Parameters
mailMessageMail message to copy from.

Member Function Documentation

◆ AddAttachment() [1/5]

MailMessage UT.MailMessage.AddAttachment ( string  attachmentPath)

Adds an attachment from a file specified by full path.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
attachmentPathA full path of a file to attach.

◆ AddAttachment() [2/5]

MailMessage UT.MailMessage.AddAttachment ( global::System.IO.Stream  stream,
string  fileName 
)

Adds an attachment from System.IO.Stream.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
streamSystem.IO.Stream to write as an attachment.
fileNameThe attachment file name to be displayed for recipients.

◆ AddAttachment() [3/5]

MailMessage UT.MailMessage.AddAttachment ( byte []  byteBuffer,
string  fileName 
)

Adds an attachment from a byte buffer, i.e. byte[].

Returns
The same MailMessage object for convenient chain initialization.
Parameters
byteBufferA byte buffer to write as an attachment.
fileNameThe attachment file name to be displayed for recipients.

◆ AddAttachment() [4/5]

MailMessage UT.MailMessage.AddAttachment ( string  text,
global::System.Text.Encoding  targetEncoding,
string  fileName 
)

Adds an attachment from text.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
textA text to write as an attachment.
targetEncodingSpecifies the target attachment file encoding.
fileNameThe attachment file name to be displayed for recipients.

◆ AddAttachment() [5/5]

MailMessage UT.MailMessage.AddAttachment ( string  text,
string  fileName 
)

Adds an attachment from text.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
textA text to write as an attachment.
fileNameThe attachment file name to be displayed for recipients.

The target attachment file encoding will be UTF-8.

◆ AddBcc()

MailMessage UT.MailMessage.AddBcc ( string  emailAddress)

Adds "Bcc" recipient ("send as hidden copy").

Returns
The same MailMessage object for convenient chain initialization.
Parameters
emailAddressEmail address.

macOS email composing API doesn't support specifying "Bcc" recipients - emailAddress will be added as "To" when composing on macOS.

◆ AddCC()

MailMessage UT.MailMessage.AddCC ( string  emailAddress)

Adds "Cc" recipient ("send as copy").

Returns
The same MailMessage object for convenient chain initialization.
Parameters
emailAddressEmail address.

macOS email composing API doesn't support specifying "Cc" recipients - emailAddress will be added as "To" when composing on macOS.

◆ AddTo()

MailMessage UT.MailMessage.AddTo ( string  emailAddress)

Adds "To" recipient.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
emailAddressEmail address.

◆ SetBody()

MailMessage UT.MailMessage.SetBody ( string  body)

Sets the email message body.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
bodyBody. May contain HTML tags if IsBodyHtml is enabled (not supported in Windows and Windows Store builds).

◆ SetBodyHtml()

MailMessage UT.MailMessage.SetBodyHtml ( bool  isBodyHtml)

Specifies whether Body should be interpreted as HTML.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
isBodyHtmlSpecifies whether HTML is enabled or not.

Not supported in Windows and Windows Store builds. For more details please see: https://support.microsoft.com/en-us/help/268440/info-mapi-is-not-suitable-for-html-messages and https://social.msdn.microsoft.com/Forums/en-US/8125da13-7d79-4a5a-82a5-57c8a322be78/uwp10240c-emailmessage-with-emailmessagebodykindhtml

◆ SetSubject()

MailMessage UT.MailMessage.SetSubject ( string  subject)

Sets the email message subject.

Returns
The same MailMessage object for convenient chain initialization.
Parameters
subjectSubject.

Property Documentation

◆ Attachments

new AttachmentCollection UT.MailMessage.Attachments
get

A collection of all attachments.

The attachments.

◆ Bcc

new MailAddressCollection UT.MailMessage.Bcc
get

A collection of "To" recipients.

macOS email composing API doesn't support specifying "Bcc" recipients - they will be added as "To" when composing on macOS.

◆ Body

new string UT.MailMessage.Body
getset

Gets or sets email message body.

Body.

◆ CC

new MailAddressCollection UT.MailMessage.CC
get

A collection of "To" recipients.

macOS email composing API doesn't support specifying "Cc" recipients - they will be added as "To" when composing on macOS.

◆ IsBodyHtml

new bool UT.MailMessage.IsBodyHtml
getset

Specifies whether Body should be interpreted as HTML.

Returns
The same MailMessage object for convenient chain initialization.

Specifies whether HTML is enabled or not.

Not supported in Windows and Windows Store builds. For more details please see: https://support.microsoft.com/en-us/help/268440/info-mapi-is-not-suitable-for-html-messages and https://social.msdn.microsoft.com/Forums/en-US/8125da13-7d79-4a5a-82a5-57c8a322be78/uwp10240c-emailmessage-with-emailmessagebodykindhtml

◆ Subject

new string UT.MailMessage.Subject
getset

Gets or sets email message subject.

Subject.

◆ To

new MailAddressCollection UT.MailMessage.To
get

A collection of "To" recipients.


The documentation for this class was generated from the following file: