Send Email Using .Net
use the following code the generate an email by using .netÂ
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
message.To.Add(new MailAddress("to@yahoo.com"));
message.Subject = "New email subject";
message.IsBodyHtml = true;
message.Body = "your email text of email will come here";
string hostname = "mail.hostname.com";
client.Host = hostname;
string username = "info@yourdomainname.com";
string password = "yourpasswordhere";
message.From = new MailAddress("from@domainname.com");
System.Net.NetworkCredential basicCredentials = new System.Net.NetworkCredential(username, password);
client.Credentials = basicCredentials;
client.Send(message);
message.body = “your actual email text”
following name space will be used for it.
using System.Net.Mail;
