C# Класс SendGrid.Mail

Наследование: IMail
Показать файл Открыть проект

Открытые методы

Метод Описание
AddAttachment ( Stream stream, string name ) : void

Add a stream as an attachment to the message

AddAttachment ( Stream stream, string name, string contentType ) : void

Add a stream as an attachment to the message

AddAttachment ( Stream stream, string name, string contentType, string contentId ) : void

Add a stream as an attachment to the message

AddAttachment ( string filePath ) : void

Add an attachment to the message.

AddBcc ( string>.IDictionary addresssInfo ) : void

Add to the 'Bcc' address.

AddBcc ( IEnumerable addresses ) : void

Add to the 'Bcc' address.

AddBcc ( string address ) : void

Add to the 'Bcc' address.

AddCc ( string>.IDictionary addresssInfo ) : void

Add to the 'CC' address.

AddCc ( IEnumerable addresses ) : void

Add to the 'CC' address.

AddCc ( string address ) : void

Add to the 'CC' address.

AddHeaders ( string>.IDictionary headers ) : void

Add custom headers to the message

AddSubstitution ( string replacementTag, List substitutionValues ) : void

Defines a mapping between a replacement string in the text of the message to a list of substitution values to be used, one per each recipient, in the same order as the recipients were added.

AddTo ( string>.IDictionary addresssInfo ) : void

Add to the 'To' address.

AddTo ( IEnumerable addresses ) : void

Add to the 'To' address.

AddTo ( string address ) : void

Add to the 'To' address.

AddUniqueIdentifiers ( string>.IDictionary identifiers ) : void

This adds parameters and values that will be passed back through SendGrid's Event API if an event notification is triggered by this email.

CreateMimeMessage ( ) : MailMessage

Used by the Transport object to create a MIME for SMTP

DisableBcc ( ) : void

Disable Bcc app

DisableBypassListManagement ( ) : void

Disable the Bypass List Management app

DisableClickTracking ( ) : void

Disable the click tracking app

DisableFooter ( ) : void

Disable the footer app

DisableGoogleAnalytics ( ) : void

Disable the Google Analytics app

DisableGravatar ( ) : void

Disable the gravatar app

DisableOpenTracking ( ) : void

Disable the open tracking app

DisableSpamCheck ( ) : void

Disable the spam check

DisableTemplate ( ) : void

Disable the templates app

DisableUnsubscribe ( ) : void

Disable the unsubscribe app

EnableBcc ( string email ) : void

Automatically sends a blind carbon copy to an address for every e-mail sent, without adding that address to the header.

EnableBypassListManagement ( ) : void

Enabing this app will bypass the normal unsubscribe / bounce / spam report checks and queue the e-mail for delivery.

EnableClickTracking ( bool includePlainText = false ) : void

Causes all links to be overwritten, shortened, and pointed to SendGrid's servers so clicks will be tracked.

EnableFooter ( string text = null, string html = null ) : void

Attaches a message at the footer of the email

EnableGoogleAnalytics ( string source, string medium, string term, string content = null, string campaign = null ) : void

Re-writes links to integrate with Google Analytics

EnableGravatar ( ) : void

Inserts the gravatar image of the sender to the bottom of the message

EnableOpenTracking ( ) : void

Adds an invisible image to the end of the email which can track e-mail opens.

EnableSpamCheck ( int score = 5, string url = null ) : void

Provides notification when emails are detected that exceed a predefined spam threshold.

EnableTemplate ( string html ) : void

Wraps an HTML template around your email content.

EnableUnsubscribe ( string replace ) : void

Allows SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender

EnableUnsubscribe ( string text, string html ) : void

Allows SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender

GetInstance ( ) : Mail

Creates an instance of SendGrid's custom message object

GetInstance ( MailAddress from, MailAddress to, MailAddress cc, MailAddress bcc, string subject, string html, string text ) : Mail

Creates an instance of SendGrid's custom message object with mail parameters

GetRecipients ( ) : IEnumerable

GetRecipients returns a list of all the recipients by retrieving the to, cc, and bcc lists.

SetCategories ( IEnumerable categories ) : void

SetCategory ( string category ) : void

This sets the category for this email. Statistics are stored on a per category basis, so this can be useful for tracking on a per group basis.

Приватные методы

Метод Описание
InitializeFilters ( ) : string>.Dictionary
Mail ( IHeader header ) : System
Mail ( MailAddress from, MailAddress to, MailAddress cc, MailAddress bcc, string subject, string html, string text, IHeader header = null ) : System
SaveMessage ( string directory ) : void

Helper function lets us look at the mime before it is sent

Описание методов

AddAttachment() публичный Метод

Add a stream as an attachment to the message
public AddAttachment ( Stream stream, string name ) : void
stream Stream Stream of file to be attached
name string Name of file to be attached
Результат void

AddAttachment() публичный Метод

Add a stream as an attachment to the message
public AddAttachment ( Stream stream, string name, string contentType ) : void
stream Stream Stream of file to be attached
name string Name of file to be attached
contentType string Content type of stream
Результат void

AddAttachment() публичный Метод

Add a stream as an attachment to the message
public AddAttachment ( Stream stream, string name, string contentType, string contentId ) : void
stream Stream Stream of file to be attached
name string Name of file to be attached
contentType string Content type of stream
contentId string ContentId for embedding images
Результат void

AddAttachment() публичный Метод

Add an attachment to the message.
public AddAttachment ( string filePath ) : void
filePath string a fully qualified file path as a string
Результат void

AddBcc() публичный Метод

Add to the 'Bcc' address.
public AddBcc ( string>.IDictionary addresssInfo ) : void
addresssInfo string>.IDictionary the dictionary keys are the email addresses, which points to a dictionary of /// key substitutionValues pairs mapping to other address codes, such as { [email protected] => { 'DisplayName' => 'Mr Foo' } }
Результат void

AddBcc() публичный Метод

Add to the 'Bcc' address.
public AddBcc ( IEnumerable addresses ) : void
addresses IEnumerable a list of emails as an array of strings.
Результат void

AddBcc() публичный Метод

Add to the 'Bcc' address.
public AddBcc ( string address ) : void
address string a single email as the input eg "[email protected]"
Результат void

AddCc() публичный Метод

Add to the 'CC' address.
public AddCc ( string>.IDictionary addresssInfo ) : void
addresssInfo string>.IDictionary the dictionary keys are the email addresses, which points to a dictionary of /// key substitutionValues pairs mapping to other address codes, such as { [email protected] => { 'DisplayName' => 'Mr Foo' } }
Результат void

AddCc() публичный Метод

Add to the 'CC' address.
public AddCc ( IEnumerable addresses ) : void
addresses IEnumerable a list of email addresses as strings
Результат void

AddCc() публичный Метод

Add to the 'CC' address.
public AddCc ( string address ) : void
address string a single email address eg "[email protected]"
Результат void

AddHeaders() публичный Метод

Add custom headers to the message
public AddHeaders ( string>.IDictionary headers ) : void
headers string>.IDictionary key substitutionValues pairs
Результат void

AddSubstitution() публичный Метод

Defines a mapping between a replacement string in the text of the message to a list of substitution values to be used, one per each recipient, in the same order as the recipients were added.
public AddSubstitution ( string replacementTag, List substitutionValues ) : void
replacementTag string the string in the email that you'll replace eg. '-name-'
substitutionValues List a list of values that will be substituted in for the replacementTag, one for each recipient
Результат void

AddTo() публичный Метод

Add to the 'To' address.
public AddTo ( string>.IDictionary addresssInfo ) : void
addresssInfo string>.IDictionary the dictionary keys are the email addresses, which points to a dictionary of /// key substitutionValues pairs mapping to other address codes, such as { [email protected] => { 'DisplayName' => 'Mr Foo' } }
Результат void

AddTo() публичный Метод

Add to the 'To' address.
public AddTo ( IEnumerable addresses ) : void
addresses IEnumerable list of email addresses as strings
Результат void

AddTo() публичный Метод

Add to the 'To' address.
public AddTo ( string address ) : void
address string single string eg. '[email protected]'
Результат void

AddUniqueIdentifiers() публичный Метод

This adds parameters and values that will be passed back through SendGrid's Event API if an event notification is triggered by this email.
public AddUniqueIdentifiers ( string>.IDictionary identifiers ) : void
identifiers string>.IDictionary parameter substitutionValues pairs to be passed back on event notification
Результат void

CreateMimeMessage() публичный Метод

Used by the Transport object to create a MIME for SMTP
public CreateMimeMessage ( ) : MailMessage
Результат SendGrid.Net.Mail.MailMessage

DisableBcc() публичный Метод

Disable Bcc app
public DisableBcc ( ) : void
Результат void

DisableBypassListManagement() публичный Метод

Disable the Bypass List Management app
public DisableBypassListManagement ( ) : void
Результат void

DisableClickTracking() публичный Метод

Disable the click tracking app
public DisableClickTracking ( ) : void
Результат void

DisableFooter() публичный Метод

Disable the footer app
public DisableFooter ( ) : void
Результат void

DisableGoogleAnalytics() публичный Метод

Disable the Google Analytics app
public DisableGoogleAnalytics ( ) : void
Результат void

DisableGravatar() публичный Метод

Disable the gravatar app
public DisableGravatar ( ) : void
Результат void

DisableOpenTracking() публичный Метод

Disable the open tracking app
public DisableOpenTracking ( ) : void
Результат void

DisableSpamCheck() публичный Метод

Disable the spam check
public DisableSpamCheck ( ) : void
Результат void

DisableTemplate() публичный Метод

Disable the templates app
public DisableTemplate ( ) : void
Результат void

DisableUnsubscribe() публичный Метод

Disable the unsubscribe app
public DisableUnsubscribe ( ) : void
Результат void

EnableBcc() публичный Метод

Automatically sends a blind carbon copy to an address for every e-mail sent, without adding that address to the header.
public EnableBcc ( string email ) : void
email string A single email recipient
Результат void

EnableBypassListManagement() публичный Метод

Enabing this app will bypass the normal unsubscribe / bounce / spam report checks and queue the e-mail for delivery.
public EnableBypassListManagement ( ) : void
Результат void

EnableClickTracking() публичный Метод

Causes all links to be overwritten, shortened, and pointed to SendGrid's servers so clicks will be tracked.
public EnableClickTracking ( bool includePlainText = false ) : void
includePlainText bool true if links found in plain text portions of the message are to be overwritten
Результат void

EnableFooter() публичный Метод

Attaches a message at the footer of the email
public EnableFooter ( string text = null, string html = null ) : void
text string Message for the plain text body of the email
html string Message for the HTML body of the email
Результат void

EnableGoogleAnalytics() публичный Метод

Re-writes links to integrate with Google Analytics
public EnableGoogleAnalytics ( string source, string medium, string term, string content = null, string campaign = null ) : void
source string Name of the referrer source (e.g. Google, SomeDomain.com, NewsletterA)
medium string Name of the marketing medium (e.g. Email)
term string Identify paid keywords
content string Use to differentiate ads
campaign string Name of the campaign
Результат void

EnableGravatar() публичный Метод

Inserts the gravatar image of the sender to the bottom of the message
public EnableGravatar ( ) : void
Результат void

EnableOpenTracking() публичный Метод

Adds an invisible image to the end of the email which can track e-mail opens.
public EnableOpenTracking ( ) : void
Результат void

EnableSpamCheck() публичный Метод

Provides notification when emails are detected that exceed a predefined spam threshold.
public EnableSpamCheck ( int score = 5, string url = null ) : void
score int Emails with a SpamAssassin score over this substitutionValues will be considered spam and not be delivered.
url string SendGrid will send an HTTP POST request to this url when a message is detected as spam
Результат void

EnableTemplate() публичный Метод

Wraps an HTML template around your email content.
public EnableTemplate ( string html ) : void
html string HTML that your emails will be wrapped in, containing a body replacementTag.
Результат void

EnableUnsubscribe() публичный Метод

Allows SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender
public EnableUnsubscribe ( string replace ) : void
replace string Tag in the message body to be replaced with the unsubscribe link and message
Результат void

EnableUnsubscribe() публичный Метод

Allows SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender
public EnableUnsubscribe ( string text, string html ) : void
text string string for the plain text email body showing what you want the message to look like.
html string string for the HTML email body showing what you want the message to look like.
Результат void

GetInstance() публичный статический Метод

Creates an instance of SendGrid's custom message object
public static GetInstance ( ) : Mail
Результат Mail

GetInstance() публичный статический Метод

Creates an instance of SendGrid's custom message object with mail parameters
public static GetInstance ( MailAddress from, MailAddress to, MailAddress cc, MailAddress bcc, string subject, string html, string text ) : Mail
from SendGrid.Net.Mail.MailAddress The email address of the sender
to SendGrid.Net.Mail.MailAddress An array of the recipients
cc SendGrid.Net.Mail.MailAddress Supported over SMTP, with future plans for support in the Web transport
bcc SendGrid.Net.Mail.MailAddress Blind recipients
subject string The subject of the message
html string the html content for the message
text string the plain text part of the message
Результат Mail

GetRecipients() публичный Метод

GetRecipients returns a list of all the recipients by retrieving the to, cc, and bcc lists.
public GetRecipients ( ) : IEnumerable
Результат IEnumerable

SetCategories() публичный Метод

public SetCategories ( IEnumerable categories ) : void
categories IEnumerable
Результат void

SetCategory() публичный Метод

This sets the category for this email. Statistics are stored on a per category basis, so this can be useful for tracking on a per group basis.
public SetCategory ( string category ) : void
category string categories applied to the message
Результат void