I am trying to get my C#.NET program to send an email with code which used to work. I do get warnings that the code is outdated. Here it is.
Can anyone find the problem or simply have working code to take its place? I just need to send an email. The machine running my program will be an XP machine.
Thanks,
newbieweb
MailMessage mailMsg = new MailMessage();
mailMsg.From = fromAddress;
mailMsg.To = toAddress;
mailMsg.Subject = subject;
mailMsg.Body = messageBody;
mailMsg.Fields.Add("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailMsg.Fields.Add("
http://schemas.microsoft.com/cdo/configuration/sendusername", "target@123.com");
mailMsg.Fields.Add("
http://schemas.microsoft.com/cdo/configuration/sendpassword", "123");
SmtpMail.SmtpServer = Configuration.SMTPServer;
SmtpMail.Send(mailMsg);
mailMsg = null;
Start Free Trial