Class MailUtility
Provides functions for sending email using either Office 365 SMTP service or SharePoint's SendEmail utility
Inheritance
Namespace: PnP.Framework.Utilities
Assembly: PnP.Framework.dll
Syntax
public static class MailUtility : object
Methods
SendEmail(ClientContext, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email using the SharePoint SendEmail method
Declaration
public static void SendEmail(ClientContext context, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body)
Parameters
Client Context for SharePoint objects and operations |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
SendEmail(ClientContext, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email using the SharePoint SendEmail method
Declaration
public static void SendEmail(ClientContext context, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body)
Parameters
Client Context for SharePoint objects and operations |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
SendEmail(String, String, SecureString, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, SecureString fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, SecureString, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, SecureString fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, String, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, string fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, String, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, string fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, String, SecureString, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, string username, SecureString password, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, String, String, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, string username, string password, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmail(String, String, String, String, IEnumerable<String>, IEnumerable<String>, String, String, Boolean, Object)
Sends an email via Office 365 SMTP
Declaration
public static void SendEmail(string servername, string fromAddress, string username, string password, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body, bool sendAsync = false, object asyncUserToken = null)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
System. Sends the email asynchronous so as to not block the current thread (default: false). |
System. The user token that is used to correlate the asynchronous email message. |
SendEmailAsync(String, String, SecureString, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, SecureString fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|
SendEmailAsync(String, String, SecureString, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, SecureString fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|
SendEmailAsync(String, String, String, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, string fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|
SendEmailAsync(String, String, String, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, string fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|
SendEmailAsync(String, String, String, SecureString, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, string username, SecureString password, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The user setting up the SMTP connection. This user must have an EXO license. |
Secure The secure password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|
SendEmailAsync(String, String, String, String, IEnumerable<String>, IEnumerable<String>, IEnumerable<String>, String, String)
Sends an email via Office 365 SMTP as an asynchronous operation
Declaration
public static async Task SendEmailAsync(string servername, string fromAddress, string username, string password, IEnumerable<String> to, IEnumerable<String> cc, IEnumerable<String> bcc, string subject, string body)
Parameters
System. Office 365 SMTP address. By default this is smtp.office365.com. |
System. The address to use as the sender address |
System. The user setting up the SMTP connection. This user must have an EXO license. |
System. The password of the user. |
IEnumerable<String>
to
List of TO addresses. |
IEnumerable<String>
cc
List of CC addresses. |
IEnumerable<String>
bcc
List of BCC addresses. |
System. Subject of the mail. |
System. HTML body of the mail. |
Returns
Task
|