warning CS0618: ‘System.Web.Mail.SmtpMail’ is obsolete:
Previously in .net 1.0 and 1.1, to send mail from a console application, you could use
using System.Web.Mail
and use a method similar to this:
static void SendMail()
{
MailMessage msg = new MailMessage();
msg.To = “toaddress1@whatever.com,toaddress2@blah.com”;
msg.From = “fromaddress@whatever.com”;
msg.Subject = “My Subject”;
msg.Body = “My Body”;
msg.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = “yourmailserveraddressorip”;
SmtpMail.Send(msg);
}
If you then upgrade to .net 2.0, you will get this when building:
warning [...]
Comments (1) | 110 views
