Hello Friends,
I need to send and Email when Any Message occurs I am trying to logg the errors once I logged it I need to send the Email to them..
Thanks
Hello Friends,
I need to send and Email when Any Message occurs I am trying to logg the errors once I logged it I need to send the Email to them..
Thanks
A compbination of ELMAH and System.Net.Mail...
ELMAH:
http://code.google.com/p/elmah/
System.Net.Mail Namespace:
http://msdn.microsoft.com/en-us/library/system.net.mail.aspx
In Code:
using System.Net.Mail;
// ...
SmtpClient mailClient = new SmtpClient();
mailClient.Send(from, to, subject, body);
In Web.Config:
<system.net>
<mailSettings>
<smtp [email protected]>
<network host="smtp.gmail.com"
password="your_pwd"
port="587"
userName="[email protected]"/>
</smtp>
</mailSettings>
</system.net>
You can use log4net as your infrastructure of logging and in the config add an email appender (EventLogAppender).