Wednesday, March 23, 2011

Send mail from asp.net

1. Create a MailHelper class.

public class MailHelper
    {
        public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
        {
            MailMessage mMailMessage = new MailMessage();
            mMailMessage.From = new MailAddress(from);
            mMailMessage.To.Add(new MailAddress(to));

            if (!(string.IsNullOrEmpty(bcc)))
            {
                mMailMessage.Bcc.Add(new MailAddress(bcc));
            }

            if (string.IsNullOrEmpty(cc))
            {
                mMailMessage.CC.Add(new MailAddress(cc));
            }

            mMailMessage.Subject = subject;
            mMailMessage.Body = body;
            mMailMessage.IsBodyHtml = true;
            mMailMessage.Priority = MailPriority.Normal;

            // Instantiate a new instance of SmtpClient
            SmtpClient ss = new SmtpClient();
            //ss.EnableSsl = true;
            ss.Timeout = 10000;
            ss.DeliveryMethod = SmtpDeliveryMethod.Network;

            mMailMessage.BodyEncoding = UTF8Encoding.UTF8;
            mMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            ss.Send(mMailMessage);
        }

2. Add the following smtp configuration in Web.config file.


 
 

Wednesday, March 16, 2011

My system is damn slow, what to do?

This post is an initiative for tips to improve the speed of system running Windows 7, so that we dont waste the system resources:

1. RacTask : Microsoft Reliability Analysis task to process system reliability data.
If you want to speed up your task rather than this analysis, diable this task in TaskScheduler.
Task Scheduler > Task Scheduler Library > Microsoft > Windows > RAC > RacTask > right click > disable

2.