Solved! How to send email using C# in .Net , Simple Code

Hi,

These settings are using google email. You may configure it accordingly.

using System.Net;
using System.Net.Mail;

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.google.com");

mail.From = new MailAddress("from address");
mail.To.Add("to address");
mail.Subject = "Email Subject";
mail.Body = "Email Body";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("from address", "from address password");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);

Comments

Popular Posts

GREYCstoration Oil Paint plugin for Photoshop

Service Bus Gateway service stuck at Starting

PowerApps SubmitForm not clearing People Picker value

Apple iPhone sending SMS automatically 00447786205094

SharePoint online hub navigation not updating for other users