Tuesday, May 13, 2014

Sending email from Arvixe server

Problem:
How do I configure Arvixe server to send email from my website

Solution:
System.Net.Mail.MailMessage eMail = new System.Net.Mail.MailMessage();
eMail.IsBodyHtml = true;
eMail.Body = body;
eMail.From = new System.Net.Mail.MailAddress(fromEmail);
eMail.To.Add(toEmail);
eMail.Subject = subject;
System.Net.Mail.SmtpClient SMTP = new System.Net.Mail.SmtpClient();

SMTP.Credentials = new System.Net.NetworkCredential("user","pass");
SMTP.Host = "localhost";
SMTP.Send(eMail);

Source
http://forum.arvixe.com/smf/programming-questions-tutorials/how-to-send-asp-net-email-using-system-net-mail/

No comments:

Post a Comment