Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void SendMail(MailMessage msg)
- {
- try
- {
- var smtp = new SmtpClient();
- smtp.Send(msg);
- }
- catch (SmtpFailedRecipientException exFailed)
- {
- lblExSendMail.Text = exFailed.Message;
- }
- }
- <system.net>
- <mailSettings>
- <smtp deliveryMethod="Network" from="xyz@xyz.com">
- <network host="smtpout.secureserver.net" port="80" userName="xyz@xyz.com" password="xyz-password" />
- </smtp>
- </mailSettings>
- SmtpClient MySMTPClient;
- MailMessage myEmail;
- MySMTPClient = new SmtpClient("smtp.secureserver.net", 25);
- MySMTPClient.Credentials = new NetworkCredential("<MailID>", "<Password>");
- myEmail = new MailMessage(new MailAddress("<sender>"), new MailAddress("<receiver>"));
- myEmail.Body = "Email from Windows Azure Application";
- myEmail.Subject = "Email from Windows Azure";
- try
- {
- MySMTPClient.Send(myEmail);
- }
- catch (Exception ex)
- {
- // Display Exception Details
- }
Add Comment
Please, Sign In to add comment