C# Class SendGrid.Mail

Inheritance: IMail
Afficher le fichier Open project: advancedrei/sendgridplus-csharp

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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

Method Details

AddAttachment() public méthode

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
Résultat void

AddAttachment() public méthode

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
Résultat void

AddAttachment() public méthode

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
Résultat void

AddAttachment() public méthode

Add an attachment to the message.
public AddAttachment ( string filePath ) : void
filePath string a fully qualified file path as a string
Résultat void

AddBcc() public méthode

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' } }
Résultat void

AddBcc() public méthode

Add to the 'Bcc' address.
public AddBcc ( IEnumerable addresses ) : void
addresses IEnumerable a list of emails as an array of strings.
Résultat void

AddBcc() public méthode

Add to the 'Bcc' address.
public AddBcc ( string address ) : void
address string a single email as the input eg "[email protected]"
Résultat void

AddCc() public méthode

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' } }
Résultat void

AddCc() public méthode

Add to the 'CC' address.
public AddCc ( IEnumerable addresses ) : void
addresses IEnumerable a list of email addresses as strings
Résultat void

AddCc() public méthode

Add to the 'CC' address.
public AddCc ( string address ) : void
address string a single email address eg "[email protected]"
Résultat void

AddHeaders() public méthode

Add custom headers to the message
public AddHeaders ( string>.IDictionary headers ) : void
headers string>.IDictionary key substitutionValues pairs
Résultat void

AddSubstitution() public méthode

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
Résultat void

AddTo() public méthode

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' } }
Résultat void

AddTo() public méthode

Add to the 'To' address.
public AddTo ( IEnumerable addresses ) : void
addresses IEnumerable list of email addresses as strings
Résultat void

AddTo() public méthode

Add to the 'To' address.
public AddTo ( string address ) : void
address string single string eg. '[email protected]'
Résultat void

AddUniqueIdentifiers() public méthode

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
Résultat void

CreateMimeMessage() public méthode

Used by the Transport object to create a MIME for SMTP
public CreateMimeMessage ( ) : MailMessage
Résultat SendGrid.Net.Mail.MailMessage

DisableBcc() public méthode

Disable Bcc app
public DisableBcc ( ) : void
Résultat void

DisableBypassListManagement() public méthode

Disable the Bypass List Management app
public DisableBypassListManagement ( ) : void
Résultat void

DisableClickTracking() public méthode

Disable the click tracking app
public DisableClickTracking ( ) : void
Résultat void

DisableFooter() public méthode

Disable the footer app
public DisableFooter ( ) : void
Résultat void

DisableGoogleAnalytics() public méthode

Disable the Google Analytics app
public DisableGoogleAnalytics ( ) : void
Résultat void

DisableGravatar() public méthode

Disable the gravatar app
public DisableGravatar ( ) : void
Résultat void

DisableOpenTracking() public méthode

Disable the open tracking app
public DisableOpenTracking ( ) : void
Résultat void

DisableSpamCheck() public méthode

Disable the spam check
public DisableSpamCheck ( ) : void
Résultat void

DisableTemplate() public méthode

Disable the templates app
public DisableTemplate ( ) : void
Résultat void

DisableUnsubscribe() public méthode

Disable the unsubscribe app
public DisableUnsubscribe ( ) : void
Résultat void

EnableBcc() public méthode

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
Résultat void

EnableBypassListManagement() public méthode

Enabing this app will bypass the normal unsubscribe / bounce / spam report checks and queue the e-mail for delivery.
public EnableBypassListManagement ( ) : void
Résultat void

EnableClickTracking() public méthode

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
Résultat void

EnableFooter() public méthode

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
Résultat void

EnableGoogleAnalytics() public méthode

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
Résultat void

EnableGravatar() public méthode

Inserts the gravatar image of the sender to the bottom of the message
public EnableGravatar ( ) : void
Résultat void

EnableOpenTracking() public méthode

Adds an invisible image to the end of the email which can track e-mail opens.
public EnableOpenTracking ( ) : void
Résultat void

EnableSpamCheck() public méthode

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
Résultat void

EnableTemplate() public méthode

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.
Résultat void

EnableUnsubscribe() public méthode

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
Résultat void

EnableUnsubscribe() public méthode

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.
Résultat void

GetInstance() public static méthode

Creates an instance of SendGrid's custom message object
public static GetInstance ( ) : Mail
Résultat Mail

GetInstance() public static méthode

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
Résultat Mail

GetRecipients() public méthode

GetRecipients returns a list of all the recipients by retrieving the to, cc, and bcc lists.
public GetRecipients ( ) : IEnumerable
Résultat IEnumerable

SetCategories() public méthode

public SetCategories ( IEnumerable categories ) : void
categories IEnumerable
Résultat void

SetCategory() public méthode

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
Résultat void