Snippet Fire

Beta
 Log In    |   Sign Up

.NET : Send Mail Function from .NET

Added on Dec-15-2011 by admin
For .NET

Tags : asp-netasp-net-mvcemailmail

This is a simple snippet function which take an email address, subject string and email body string.

DOWNLOAD

public static void SendMail(string toAddress, string subject, string body)
        {
             MailMessage mail = new MailMessage( );


            mail.From = new MailAddress(SnippetApp.GlobalSettings.SupportEmailAddress);
            mail.To.Add(new MailAddress(toAddress));

            mail.Subject = subject;
            // Set the body of the mail message
            mail.Body = body;

            mail.IsBodyHtml = true;
            mail.Priority = MailPriority.Normal;

            SmtpClient mSmtpClient = new SmtpClient("localhost");
            mSmtpClient.Send(mail);

        }

    

Report Snippet

blog comments powered by Disqus