Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- Configuration configurationFile = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/web.config");
- System.Net.Configuration.MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as System.Net.Configuration.MailSettingsSectionGroup;
- string from = string.Empty;
- if (mailSettings != null)
- {
- from = mailSettings.Smtp.From;
- }
- string myString="<html><head>test email tracking </head><body><p>this is test mail for email tracking</p></body></html>";
- string toAddress = "mohanj@icore.net.in";
- myString = myString.Replace("<body>", "<body><IMG height=1 src='http://icoremail.icore.net.in/testresponse.aspx?emailsent=" + toAddress + "' width=1></IMG>");
- using (MailMessage message = new MailMessage(
- // from, "mohanj.icore@gmail.com",
- from, "mohanj@icore.net.in",
- "A report for you!", myString))
- {
- message.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Send(message);
- lblMessage.Text = " Mail Sent successfully! ";
- }
- }
- catch (Exception ex)
- {
- Response.Write(ex.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement