Send email using store procedure.

Posted by Valley under ASP.NET on 6/19/2013 | Points: 10 | Views : 933 | Status : [Member] | Replies : 1
Please see the below code and give me suggestions.

 protected void btnSubmit_Click(object sender, EventArgs e) 

MailMessage EmailMsg = new MailMessage();
EmailMsg.From = new MailAddress("", "Valley");
EmailMsg.To.Add(new MailAddress("I WANT TO CALL STORE PROCEDURE HERE"));--------------------->Database Name: Valley ------->Store Procedure Name: Request
EmailMsg.Subject = "New access request";
EmailMsg.Body = "<html><body>This is a test email<hr>Test</body></html>";
EmailMsg.IsBodyHtml = true;
EmailMsg.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("");
MailClient.Credentials = new System.Net.NetworkCredential("", "******");


Posted by: Niladri.Biswas on: 6/21/2013 [Member] Platinum | Points: 25

Use the stored procedure value

EmailMsg.To.Add(new MailAddress(".....

And call the stored procedure before

MailMessage EmailMsg = new MailMessage();

hope this helps

Best Regards,
Niladri Biswas

Valley, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response