-
Notifications
You must be signed in to change notification settings - Fork 0
Home
An example: This sample shows how to e-mail a message with an attachment:
using MimeKit;
using MailKit.Net.Smtp;
...
Extensions.NewMimeMessage().From(_fromAddress).To(_toAddress)
.Subject(_subject).Body(
Extensions.TextBody(_message)
.Attachment(_buffer, "Text.txt", "text/plain;charset=utf-8")
).SendAsync();
Namespace of MimeKit. MimeKit is an external namespace from the MailKit/MimeKit libraries. This appends the MimeKit namespace and extends the MimeMessage and BodyBuilder classes.
Fluent extension methods for MimeMessage and BodyBuilder classes in the MimeKit library.
Set the from address with a string of a single email address.
This MimeMessage.
string of an email address
this, MimeMessage to allow fluent design.
Set the from address with two strings.
This MimeMessage.
string of an email address
display name of the email address
this, MimeMessage to allow fluent design.
Set the from address with an email address structure.
This MimeMessage.
A MailboxAddress class, including an email address and the name
this, MimeMessage to allow fluent design.
Set a To address with a string of a single email address.
This MimeMessage.
an email address
this, MimeMessage to allow fluent design.
Set a To address with two strings.
This MimeMessage.
an email address
display name of the email address
this, MimeMessage to allow fluent design.
Set a To address with an email address structure.
This MimeMessage.
A MailboxAddress class, including an email address and the name
this, MimeMessage to allow fluent design.
Set a carbon copy (cc) email address with a string of a single email address.
This MimeMessage.
an email address
this, MimeMessage to allow fluent design.
Set a carbon copy (cc) email address with two strings.
This MimeMessage.
an email address
display name of the email address
this, MimeMessage to allow fluent design.
Set a carbon copy (cc) email address with an email address structure.
This MimeMessage.
A MailboxAddress class, including an email address and the name
this, MimeMessage to allow fluent design.
Set a blind carbon copy (bcc) email address with a string of a single email address.
This MimeMessage.
an email address
this, MimeMessage to allow fluent design.
Set a blind carbon copy (bcc) email address with two strings.
This MimeMessage.
an email address
display name of the email address
this, MimeMessage to allow fluent design.
Set a blind carbon copy (bcc) email address with an email address structure.
This MimeMessage.
A MailboxAddress class, including an email address and the name
this, MimeMessage to allow fluent design.
Set the title of an email message.
This MimeMessage.
the subject line
this, MimeMessage to allow fluent design.
Set the body of the email message.
This MimeMessage.
Email body and any attachments.
this, MimeMessage to allow fluent design.
Set the body of the email message.
HTML Email message body.
A new BodyBuilder to allow fluent design.
Set the body of the email message with Html content.
Text e-mail body
A new BodyBuilder to allow fluent design.
Add an attachment to the mail message.
For example: This sample shows how to call attachment:
using MimeKit;
using MailKit.Net.Smtp;
...
MimeMessage _email = (new MimeMessage())
.From(_fromAddress).To(_toAddress)
.Subject(_subject).Body(
Extensions.TextBody(_message)
.Attachment(_buffer, "Text.txt", "text/plain;charset=utf-8")
);
name placed on the attachment
byte buffer containing the attachment
this BodyBuilder
mime type For example: mime type examples:
- application/pdf
- application/ms-excel
- multipart/form-data
- text/html
- text/xml
- text/plain;charset=utf-8
- image/png
- image/jpeg
- image/gif
this, BodyBuilder to allow fluent design.
Synchronously send a (this) MimeMessage via the MailKit's SmtpClient.
This MimeMessage.
Host name of the SMTP server or relay.
An integer port number.
Boolean value for enabling SSL.
Connect to the SMTP host with this userName.
Connect to the SMTP host with this user name's password.
this, MimeMessage to allow fluent design.
Synchronously send a (this) MimeMessage via the MailKit's SmtpClient. Note: This will invoke the following method: Send(this mimeMessage, smtpHost, port, ssl, userName, passWord) This invocation assumes the following parameters:
- A userName of empty string.
- A passWord of empty string.
This MimeMessage.
Host name of the SMTP server or relay.
An integer port number.
Boolean value for enabling SSL.
this, MimeMessage to allow fluent design.
Synchronously send a (this) MimeMessage via the MailKit's SmtpClient. Note: This will invoke the following method: Send(this mimeMessage, smtpHost, port, ssl, userName, passWord) This invocation assumes the following parameters:
- A smtpHost of localhost.
- A SMTP port number of 25.
- An enable SSL of false.
- A userName of empty string.
- A passWord of empty string.
This MimeMessage.
this, MimeMessage to allow fluent design.
Asynchronously send a (this) MimeMessage via the MailKit's SmtpClient.
This MimeMessage.
Host name of the SMTP server or relay.
An integer port number.
Boolean value for enabling SSL.
Connect to the SMTP host with this userName.
Connect to the SMTP host with this user name's password.
this, MimeMessage to allow fluent design.
Asynchronously send a (this) MimeMessage via the MailKit's SmtpClient. Note: This will invoke the following method: SendAsync(this mimeMessage, smtpHost, port, ssl, userName, passWord) This invocation assumes the following parameters:
- A userName of empty string.
- A passWord of empty string.
This MimeMessage.
Host name of the SMTP server or relay.
An integer port number.
Boolean value for enabling SSL.
this, MimeMessage to allow fluent design.
Asynchronously send a (this) MimeMessage via the MailKit's SmtpClient. Note: This will invoke the following method: SendAsync(this mimeMessage, smtpHost, port, ssl, userName, passWord) This invocation assumes the following parameters:
- A smtpHost of localhost.
- A SMTP port number of 25.
- An enable SSL of false.
- A userName of empty string.
- A passWord of empty string.
This MimeMessage.
this, MimeMessage to allow fluent design.