Email Factory Example

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 51
Released: Aug 3, 2009
Updated: Aug 4, 2009 by paxer
Dev status: Beta Help Icon

Recommended Download

Source Code Simple example how to use
source code, 7K, uploaded Aug 4, 2009 - 51 downloads

Release Notes

This class is the first which will be included in .Net Factory Framework. It's easy but helpful for sending emails.

  • Unlimited email group settings (Mode). It could be for example number of settings for Test and Production environments.
  • Working with predefined email templates with placeholders.
  • Ability to save email content to hdd after sending.

protected void btnSendEmail_Click(object sender, EventArgs e)
        //create key value dictionary for parse and replace placeholders in email template
        Dictionary<string, string> templateKeyValues = new Dictionary<string, string>();

        //this is example for existing placeholders in EmailTemplates/test.template
        templateKeyValues.Add("{%FIRST_NAME%}", "Jack");
        templateKeyValues.Add("{%LAST_NAME%}", "Sparrow");

        EmailFactory email =  new EmailFactory(); // this will fire with the default mode which is setup in Email.Config
        //EmailFactory email = new EmailFactory("production"); // We can also set mode manualy 
        //EmailFactory email = new EmailFactory("test");
        bool sendingStatus = false;
            //you can send mail to multiple addresses
            //email.SendMail(new string[] { "","" }, "test.template", templateKeyValues);

            string[] toEmails = new string[] { "" };
            sendingStatus = email.SendMail(toEmails, "test.template", templateKeyValues);
        catch (Exception ex)
            //log error
       if (sendingStatus)
           lblStatus.Text = "Mail sending successfull";
           lblStatus.Text = "Mail was not sent, becouse of email mode is disabled";

Reviews for this release

nice job. do more ;)
by MDP on Aug 4, 2009 at 8:18 AM