• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class MimeMessageBuilder

Builder for constructing MimeMessage instances for writing.

Inheritance
object
MimeMessageBuilder
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Rfc.Mime
Assembly: DRIT.Mail.dll
Syntax
public sealed class MimeMessageBuilder

Methods

View Source

Attachment(string, byte[], string?)

Adds an attachment with the specified filename and content.

Declaration
public MimeMessageBuilder Attachment(string fileName, byte[] content, string? contentType = null)
Parameters
Type Name Description
string fileName

The file or path to process.

byte[] content

Specifies the content value.

string contentType

The content type used by the operation.

Returns
Type Description
MimeMessageBuilder
View Source

Bcc(params MailboxAddress[])

Adds Bcc addresses.

Declaration
public MimeMessageBuilder Bcc(params MailboxAddress[] addresses)
Parameters
Type Name Description
MailboxAddress[] addresses

Specifies the addresses value.

Returns
Type Description
MimeMessageBuilder
View Source

Body(MimeEntity)

Sets the body entity directly. When set, this entity is used as the message body verbatim and the text/HTML/attachment builders are ignored. Used by S/MIME to construct multipart/signed and application/pkcs7-mime messages.

Declaration
public MimeMessageBuilder Body(MimeEntity body)
Parameters
Type Name Description
MimeEntity body

Specifies the body value.

Returns
Type Description
MimeMessageBuilder
View Source

Build()

Builds the MimeMessage.

Declaration
public MimeMessage Build()
Returns
Type Description
MimeMessage
View Source

Cc(params MailboxAddress[])

Adds Cc addresses.

Declaration
public MimeMessageBuilder Cc(params MailboxAddress[] addresses)
Parameters
Type Name Description
MailboxAddress[] addresses

Specifies the addresses value.

Returns
Type Description
MimeMessageBuilder
View Source

Date(DateTimeOffset)

Sets the Date header.

Declaration
public MimeMessageBuilder Date(DateTimeOffset date)
Parameters
Type Name Description
DateTimeOffset date

Specifies the date value.

Returns
Type Description
MimeMessageBuilder
View Source

From(params MailboxAddress[])

Adds From addresses.

Declaration
public MimeMessageBuilder From(params MailboxAddress[] addresses)
Parameters
Type Name Description
MailboxAddress[] addresses

Specifies the addresses value.

Returns
Type Description
MimeMessageBuilder
View Source

Header(string, string)

Adds a custom header.

Declaration
public MimeMessageBuilder Header(string name, string value)
Parameters
Type Name Description
string name

Specifies the name value.

string value

The value to process.

Returns
Type Description
MimeMessageBuilder
View Source

HtmlBody(string, Encoding?)

Sets the text/html body.

Declaration
public MimeMessageBuilder HtmlBody(string html, Encoding? encoding = null)
Parameters
Type Name Description
string html

Specifies the html value.

Encoding encoding

The encoding to use.

Returns
Type Description
MimeMessageBuilder
View Source

InReplyTo(string)

Sets the In-Reply-To header.

Declaration
public MimeMessageBuilder InReplyTo(string inReplyTo)
Parameters
Type Name Description
string inReplyTo

The in reply to used by the operation.

Returns
Type Description
MimeMessageBuilder
View Source

InlineAttachment(string, byte[], string)

Adds an inline attachment with the specified Content-ID.

Declaration
public MimeMessageBuilder InlineAttachment(string contentId, byte[] content, string contentType)
Parameters
Type Name Description
string contentId

The content id identifier.

byte[] content

Specifies the content value.

string contentType

The content type used by the operation.

Returns
Type Description
MimeMessageBuilder
View Source

MessageId(string)

Sets the Message-ID header.

Declaration
public MimeMessageBuilder MessageId(string messageId)
Parameters
Type Name Description
string messageId

The message id identifier.

Returns
Type Description
MimeMessageBuilder
View Source

References(string)

Sets the References header.

Declaration
public MimeMessageBuilder References(string references)
Parameters
Type Name Description
string references

Specifies the references value.

Returns
Type Description
MimeMessageBuilder
View Source

ReplyTo(params MailboxAddress[])

Adds Reply-To addresses.

Declaration
public MimeMessageBuilder ReplyTo(params MailboxAddress[] addresses)
Parameters
Type Name Description
MailboxAddress[] addresses

Specifies the addresses value.

Returns
Type Description
MimeMessageBuilder
View Source

Subject(string)

Sets the Subject header.

Declaration
public MimeMessageBuilder Subject(string subject)
Parameters
Type Name Description
string subject

Specifies the subject value.

Returns
Type Description
MimeMessageBuilder
View Source

TextBody(string, Encoding?)

Sets the text/plain body.

Declaration
public MimeMessageBuilder TextBody(string text, Encoding? encoding = null)
Parameters
Type Name Description
string text

Specifies the text value.

Encoding encoding

The encoding to use.

Returns
Type Description
MimeMessageBuilder
View Source

To(params MailboxAddress[])

Adds To addresses.

Declaration
public MimeMessageBuilder To(params MailboxAddress[] addresses)
Parameters
Type Name Description
MailboxAddress[] addresses

Specifies the addresses value.

Returns
Type Description
MimeMessageBuilder
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX