共用方式為


SPUtility.SendEmail Method (SPWeb, Boolean, Boolean, String, String, String)

Sends an e-mail message.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)> _
Public Shared Function SendEmail ( _
    web As SPWeb, _
    fAppendHtmlTag As Boolean, _
    fHtmlEncode As Boolean, _
    to As String, _
    subject As String, _
    htmlBody As String _
) 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 returnValue As Boolean

returnValue = SPUtility.SendEmail(web, _
    fAppendHtmlTag, fHtmlEncode, to, _
    subject, htmlBody)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)]
public static bool SendEmail(
    SPWeb web,
    bool fAppendHtmlTag,
    bool fHtmlEncode,
    string to,
    string subject,
    string htmlBody
)

Parameters

  • fAppendHtmlTag
    Type: System.Boolean

    true to append an HTML tag to the message; otherwise, false.

  • fHtmlEncode
    Type: System.Boolean

    true to encode the message and replace characters in HTML tags with entities; otherwise,false.

  • to
    Type: System.String

    The address to which to send the e-mail message.

  • subject
    Type: System.String

    A string that contains the subject for the e-mail message.

  • htmlBody
    Type: System.String

    A string that contains the body of the e-mail message.

Return Value

Type: System.Boolean
true if the e-mail message is sent successfully; otherwise, false.

Remarks

The e-mail message will be sent to the address (or addresses) specified in the “to”, “cc”, and “bcc” headers.

See Also

Reference

SPUtility Class

SPUtility Members

SendEmail Overload

Microsoft.SharePoint.Utilities Namespace

System.Net.Mime

Other Resources

MIME Headers