Created
November 8, 2013 21:53
-
-
Save cdeutsch/7378297 to your computer and use it in GitHub Desktop.
Mandrill example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var emailMessage = new EmailMessage | |
| { | |
| to = new List<EmailAddress>() { new EmailAddress() { email = model.Email, name = model.ShippingName } }, | |
| track_clicks = true, | |
| track_opens = true | |
| }; | |
| emailMessage.AddGlobalVariable("shipping_name", model.ShippingName.EmptyIfNull()); | |
| emailMessage.AddGlobalVariable("base_url", GetBaseUrl()); | |
| emailMessage.AddGlobalVariable("address1", model.Address1.EmptyIfNull()); | |
| emailMessage.AddGlobalVariable("address2", model.Address2.EmptyIfNull()); | |
| emailMessage.AddGlobalVariable("city", model.City.EmptyIfNull()); | |
| emailMessage.AddGlobalVariable("state", model.State.EmptyIfNull()); | |
| emailMessage.AddGlobalVariable("zipcode", model.ZipCode.EmptyIfNull()); | |
| var mandrillApi = new MandrillApi(ConfigurationManager.AppSettings["MandrillApiKey"]); | |
| mandrillApi.SendMessage(emailMessage, templateName, templateContents); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment