Exemple #1
0
        /// <summary>
        ///     This feature adds key value identifiers to be sent back as arguments over the event api for
        ///     various events
        /// </summary>
        public void AddUniqueIdentifiers()
        {
            //create a new message object
            var message = new SendGrid();

            //set the message recipients
            foreach (var recipient in _to)
            {
                message.AddTo(recipient);
            }

            //set the sender
            message.From = new MailAddress(_from);

            //set the message body
            message.Text = "Hello World";

            //set the message subject
            message.Subject = "Testing Unique Identifiers";

            var identifiers = new Dictionary<String, String>();
            identifiers["customer"] = "someone";
            identifiers["location"] = "somewhere";

            message.AddUniqueArgs(identifiers);

            //create an instance of the SMTP transport mechanism
            var transportInstance = new Web(new NetworkCredential(_username, _password));

            //enable bypass list management
            message.EnableBypassListManagement();

            //send the mail
            transportInstance.Deliver(message);
        }