Sending Emails
-
Do I need to download any smtp server or do I simply just specify it in my C# code?
ML Lingwati
You need to specify it in you C# code, but you usually either have to download or install one to be able to use it. If you already have one, and have permissions to it, all you need to do it specify it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
-
Do I need to download any smtp server or do I simply just specify it in my C# code?
ML Lingwati
You point your message to your email server. For example:
using System.Net.Mail;
class Emailer
{
private void SendEmail()
{
MailMessage theMessage = new MailMessage();
MailAddress whoTo = new MailAddress("John.Doe@abc.com", "John Doe");
MailAddress whoFrom = new MailAddress("Sue.Smith@123.com", "Sue Smith");
theMessage.To.Add(whoTo);
theMessage.From = whoFrom;
theMessage.Subject = "Real Important Message";
theMessage.Priority = MailPriority.Normal;
theMessage.Body = "This is a real important email message.";
theMessage.IsBodyHtml = true;SmtpClient client = new SmtpClient(); client.Host = "mail.123.com"; // <- Your email server goes here client.Send(theMessage); }
}
Regards, Gary