Quantcast
Viewing latest article 4
Browse Latest Browse All 10

Sending emails with a mailing list provider (Umbraco, Razor and Mad Mimi)

I wanted to use a mailing list provider for some programmatically composed emails like account confirmations and welcome messages. My needs is pretty basic, a layout with a banner, a header and a html body text. To be sent to whoever, whenever.

Besides of some familiar provider names, I recently heard about a service called “Mad Mimi”, which I liked to try out for this. They have a pretty interface and have okay deals.

Image may be NSFW.
Clik here to view.
Mad Mimi Email Marketing

Said and done, I created myself an account and made a “Promotion”, which is basically a email design with images and texts. Both static and dynamic texts {in curly braces} can be used. Here’s what my test design came to look like:

Image may be NSFW.
Clik here to view.

Yeah, I know, I’m not a designer…

Next step was to create a function with which I could compose a mail this way:

    var promotionName = "MyPromotion";
    
    var recipientName = "Jonas";
    var recipientEmail = "whoever@site.com";
    var subject = "Question";
    
    var content = @"<h2>Question</h2>
                  <p>I will get back to you soon.</p>";
    
    var dynamicContent = new {name = recipientName, content = content};
    MadMimi.SendPromotionToRecipient(promotionName,recipientEmail,subject, dynamicContent);

As I code most my code in Razor at the moment I created myself a global Razor helper (ie a App_Code\MadMimi.cshtml).

To be able to use the code you need an Api_Key which you get from Mad Mimi when you create your account. You also need to enable Api functionality (click “Add things”). Try their support if you have questions, they were very quick to answer my questions. There’s also a Google group for dev (api) questions.

I posted the complete helper code here : https://gist.github.com/880205 (also included a function to send emails to a list, I’ll probably write anoter blog post about that.)

And heureka – using the helper and the code above I got an email looking like this:

Image may be NSFW.
Clik here to view.

I hope you liked the post, please feel free to send me feedback of any kind. Happy coding!


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 4
Browse Latest Browse All 10

Trending Articles