Table of contents
TOC
Collapse the table of content
Expand the table of content

MailUtility.SendEmail Method

SharePoint Dev Documents|Last Updated: 5/20/2017
|
1 Contributor

Sends an email via Office 365 SMTP

Namespace:OfficeDevPnP.Core.Utilities
Assembly: OfficeDevPnP.Core.dll

Syntax

public static void SendEmail(String servername, String fromAddress, SecureString fromUserPassword, IEnumerable<String> to, IEnumerable<String> cc, String subject, String body, Boolean sendAsync = False, Object asyncUserToken)

Parameters

servername

  Type: System.String
  Office 365 SMTP address. By default this is smtp.office365.com.

fromAddress

  Type: System.String
  The user setting up the SMTP connection. This user must have an EXO license.

fromUserPassword

  Type: System.Security.SecureString
  The secure password of the user.

to

  Type: System.Collections.Generic.IEnumerable<System.String>
  List of TO addresses.

cc

  Type: System.Collections.Generic.IEnumerable<System.String>
  List of CC addresses.

subject

  Type: System.String
  Subject of the mail.

body

  Type: System.String
  HTML body of the mail.

(optional) sendAsync

  Type: System.Boolean
  Sends the email asynchronous so as to not block the current thread (default: false).

(optional) asyncUserToken

  Type: System.Object
  The user token that is used to correlate the asynchronous email message.

Return Value

Type: void

See also

© 2018 Microsoft