SPUtility.SendEmail method (SPWeb, Boolean, Boolean, String, String, String, Boolean)
Sends the e-mail message to the specified address.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function SendEmail ( _
web As SPWeb, _
fAppendHtmlTag As Boolean, _
fHtmlEncode As Boolean, _
to As String, _
subject As String, _
htmlBody As String, _
appendFooter As Boolean _
) As Boolean
'Usage
Dim web As SPWeb
Dim fAppendHtmlTag As Boolean
Dim fHtmlEncode As Boolean
Dim to As String
Dim subject As String
Dim htmlBody As String
Dim appendFooter As Boolean
Dim returnValue As Boolean
returnValue = SPUtility.SendEmail(web, _
fAppendHtmlTag, fHtmlEncode, to, _
subject, htmlBody, appendFooter)
public static bool SendEmail(
SPWeb web,
bool fAppendHtmlTag,
bool fHtmlEncode,
string to,
string subject,
string htmlBody,
bool appendFooter
)
Parameters
web
Type: Microsoft.SharePoint.SPWebAn SPWeb object that represents the site.
fAppendHtmlTag
Type: System.Booleantrue to append an HTML tag to the message; otherwise, false.
fHtmlEncode
Type: System.Booleantrue to encode the message and replace characters in HTML tags with entities; otherwise, false.
to
Type: System.StringThe address to which to send the e-mail message.
subject
Type: System.StringA string that contains the subject for the e-mail message.
htmlBody
Type: System.StringA string that contains the body of the e-mail message.
appendFooter
Type: System.Booleantrue if the site’s e-mail footer should be appended to the message body; otherwise, false.
Return value
Type: System.Boolean
true if the e-mail message is sent successfully; otherwise, false.
Remarks
The site’s email footer comes from the ServerEmailFooter CAML tag in the site’s definition
Note
This method supports sending email messages only to valid SharePoint user email addresses.