aspdotnetuser
Programmer
Hi,
Any comments and suggestions will be appreciated!
I currently have the following send email code hard coded into a .cs file, it uses System.Web.Mail but will use the more updated methods later.
[blue]MailMessage email = new MailMessage();
email.To = "emailaddress@email.com";
email.From = "do_not_reply@email.com";
email.BodyFormat = MailFormat.Html;
email.Subject = "Test email";
email.Body ="Test email";[/blue]
try
{
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"].ToString();
SmtpMail.Send(email);
}
catch
{}
What would I use instead of the code in try{} (in red) if I had the SMTP settings setup in web.config within the System.Net tag?
Sorry if my question isn't very clear!
Any comments and suggestions will be appreciated!
I currently have the following send email code hard coded into a .cs file, it uses System.Web.Mail but will use the more updated methods later.
[blue]MailMessage email = new MailMessage();
email.To = "emailaddress@email.com";
email.From = "do_not_reply@email.com";
email.BodyFormat = MailFormat.Html;
email.Subject = "Test email";
email.Body ="Test email";[/blue]
try
{
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"].ToString();
SmtpMail.Send(email);
}
catch
{}
What would I use instead of the code in try{} (in red) if I had the SMTP settings setup in web.config within the System.Net tag?
Sorry if my question isn't very clear!