Hi,

I have to send a notification to my clients using a email template. For eg if i have updated some data a notification should be send to them that some updates have done. So how can i do that? Please help me out its very urgent.

Recommended Answers

All 3 Replies

Every time you update database with some data, send new e-mail:

try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtpServer");

                mail.From = new MailAddress("");
                mail.To.Add("");
                mail.Subject = "";
                mail.Body = "";

                SmtpServer.Port = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
                SmtpServer.EnableSsl = true;

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
// Redirect to error page
            }

Hi jugosoft,

Thanks for your reply. actually i'm doing a recruitment service. So there are different users. For example if A is logging in and raising a request it should be send to B. And b after accomplishing that request should send to B and C. So is this code working in that way. Please reply.

That code is for sending mail. You can have collumns for receivers of mail or you can have one collumn with data that are splited with eg. ';'. You also need a collumn that constains if mail was sent to A, B, C....

This is combination of simple reading data from database and mail sending.

To check if mail was sent to eg. 'A' > 'B' use 'if' statement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.