using System; using System.Collections.Generic; using System.Linq; using System.Net.Mail; using System.Text; namespace SendGridMail { /// /// Represents the additional functionality to add SendGrid specific mail headers /// public interface IHeader { /// /// Gets the array of recipient addresses from the X-SMTPAPI header /// IEnumerable To { get; } /// /// This adds a substitution value to be used during the mail merge. Substitutions /// will happen in order added, so calls to this should match calls to addTo in the mail message. /// /// string to be replaced in the message /// substitutions to be made, one per recipient void AddSubVal(String tag, IEnumerable substitutions); /// /// This adds the "to" array to the X-SMTPAPI header so that multiple recipients /// may be addressed in a single email. (but they each get their own email, instead of a single email with multiple TO: addressees) /// /// List of email addresses void AddTo(IEnumerable addresses); /// /// This adds parameters and values that will be bassed back through SendGrid's /// Event API if an event notification is triggered by this email. /// /// parameter value pairs to be passed back on event notification void AddUniqueIdentifier(IDictionary identifiers); /// /// 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. /// /// categories applied to the message void SetCategory(String category); /// /// This sets the categories for this email. Statistics are stored on a per category /// basis, so this can be useful for tracking on a per group basis. /// /// categories applied to the message void SetCategories(IEnumerable categories); /// /// Shortcut method for enabling a filter. /// /// The name of the filter to enable void Enable(String filter); /// /// Shortcut method for disabling a filter. /// /// The name of the filter to disable void Disable(String filter); /// /// Allows you to specify a filter setting. You can find a list of filters and settings here: /// http://docs.sendgrid.com/documentation/api/web-api/filtersettings/ /// /// The name of the filter to set /// The multipart name of the parameter being set /// The value that the settings name will be assigning void AddFilterSetting(String filter, IEnumerable settings, String value); /// /// Attaches the SendGrid headers to the MIME. /// /// the MIME to which we are attaching void AddHeader(MailMessage mime); /// /// Converts the filter settings into a JSON string. /// /// String representation of the SendGrid headers String AsJson(); } }