This project is read-only.

Email and Event log helpers

Rating: No reviews yet
Downloads: 144
Released: Aug 16, 2009
Updated: Aug 17, 2009 by paxer
Dev status: Beta Help Icon

Recommended Download

Source Code Source and Usage Example
source code, 13K, uploaded Aug 17, 2009 - 144 downloads

Release Notes

Sending Email with templates and Event Log helpers.

Both classes are using "Mode" feature. That's mean that you can easily setup settings for each class in it config files depending from environment for example Test, Development, Production environment could have different settings.

Email Factory Features
  • Unlimited email group settings (Modes).
  • Working with custom email templates with placeholders for variables.
  • Ability to save email content to HDD after sending.

Event Factory Features
  • Unlimited "Mode" settings.
  • Colors for each event for easy implementation UI in html.
  • Several notification modes like Save event on HDD or Email event or Both.
  • Save event log in XML for easy DataBinding or in TXT files.
  • Clear event log file if it size more than size in current mode settings.

Email Factory usage example

        //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[] { tbxSendToEmail.Text };
            string[] attachedFilesPath = null;
            if (FileUpload1.FileName != string.Empty)
                attachedFilesPath = new string[] { this.UploadFiles() };
            sendingStatus = email.SendMail(toEmails, "test.template", templateKeyValues, attachedFilesPath);
        catch (Exception ex)
            //log error
       if (sendingStatus)
           lblStatus.Text = "Mail sending successfull";
           lblStatus.Text = "Mail was not sent, becouse of email mode is disabled";

Event Factory usage example

        EventFactory newEvent = new EventFactory(eventType, tbxEventDescription.Text, EventNotificationType.Save);

        //EventFactory newEvent = new EventFactory(eventType, tbxEventDescription.Text, EventNotificationType.Save);
        //EventFactory newEvent = new EventFactory(eventType, tbxEventDescription.Text, EventNotificationType.Email);
        //EventFactory newEvent = new EventFactory(eventType, tbxEventDescription.Text, EventNotificationType.EmailAndSave);
        //EventFactory newEvent = new EventFactory(eventType, EventColor.Red, " Some Description", EventNotificationType.Save);

        //EventFactory someEvent = new EventFactory();
        //someEvent.AddEvent(eventType, tbxEventDescription.Text, EventNotificationType.EmailAndSave);

Reviews for this release

No reviews yet for this release.