954,577 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Emailing from a simple web application

Hi, i am developing a simple web application for fault reporting. Users log into the system and report a fault which is then added to a database. I want to be able to email the system administrator a log file containing the information which has been added to the database. Any help on what i need to look at would be much appreciated.thanks

.netidiot
Newbie Poster
21 posts since Mar 2009
Reputation Points: 8
Solved Threads: 0
 

Hi,

Here is the way. u can send mail to admin, while entering the data into DB

using System.Net.Mail;

                MailMessage msgMail = null;                
                MailAddress objMAddTo,objMAddFrom = null;
                SmtpClient objSMTP = new SmtpClient();
                objSMTP.Host = ""; // set your SMTP mail server.. domainname or the IP

                     objMAddTo = new MailAddress("admin@test.com"); //Admin details
                     objMAddFrom = new MailAddress("user@test.com", "User"); // sender details
                     msgMail = new MailMessage(objMAddFrom, objMAddTo);
                    msgMail.IsBodyHtml = true; // if your Body contains HTML tags
                    msgMail.Subject = "Report Fault Error";
                    msgMail.Body = "Hi Admin,  Error Reporting here"; //your complete email body contents here
                    objSMTP.Send(msgMail);
vizy
Light Poster
36 posts since Dec 2007
Reputation Points: 10
Solved Threads: 6
 

Hi ill post the current error I am getting having implemented the code incase i am unable to solve in myself.


Callbacks are not supported on CommandField when the select button is enabled because other controls on your page that are dependent on the selected value of 'GridView1' for their rendering will not update in a callback. Turn callbacks off on 'GridView1'.

.netidiot
Newbie Poster
21 posts since Mar 2009
Reputation Points: 8
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You