To send a transaction email using Marketing Cloud and .NET, you must do the following.
- Create the Email (in Email Studio)
- Use AMPScript for the replacement tags
- Create a Triggered Send and Associate with Email Above (http://help.marketingcloud.com/en/documentation/exacttarget/interactions/triggered_emails/triggered_emails_guide/how_to_create_a_triggered_email_message_interaction/)
- If you change the email template, pause the Triggered Send, Republish it, and start it again.
Thanks to Markus - https://salesforce.stackexchange.com/questions/178900/can-i-use-marketing-cloud-for-transactional-emails-just-like-mandrill#178906
//uses the Nuget Package: ExactTarget.TriggerEmailSender
//.NET code
//create configuration
var config = new ExactTarget.TriggeredEmail.Core.Configuration.ExactTargetConfiguration
{
ApiUserName = "myemail@example.com",
ApiPassword = "myUbreakablePassWord!",
//use your endpoint given to you by ET, login to MC and look at your url
EndPoint = "https://webservice.s7.exacttarget.com/Service.asmx",
//ClientId = 1111111,//optional business unit id
};
//name of the triggered send
var emailTemplateName = "trig--tran--test--password-reset";
//send email
var recipientEmailAddress = "myemail@example.com";
var triggeredEmail = new ExactTarget.TriggeredEmail.Trigger.ExactTargetTriggeredEmail(
emailTemplateName,
recipientEmailAddress);
triggeredEmail.SubscriberKey = recipientEmailAddress; //not needed
//set replacement/merge tags
triggeredEmail.AddReplacementValue("first_name", "John");
triggeredEmail.AddReplacementValue("login_link", "http://www.example.com/login");
var emailTrigger = new ExactTarget.TriggeredEmail.Trigger.EmailTrigger(config);
//final call to actually send the email
emailTrigger.Trigger(triggeredEmail);
//MC Email and AMPScript
%%[
Var @link
Set @link = AttributeValue("login_link")
Var @firstName
Set @firstName = AttributeValue("first_name")
]%%
<p>Dear %%=v(@firstName)=%%</p>
<a href="%%=RedirectTo(@link)=%%">%%=v(@link)=%%</a>