So formatieren Sie text in E-Mail wenn Sie smtp

Verwende ich die folgende Methode, um eine E-Mail senden. Ich möchte in der Lage sein, formatieren Sie die E-Mail mit Fett gedruckter text.

Ex.

Aus: Namen

E-Mail: E-Mail-Adresse

Nachricht: Nachricht

Wie kann ich dies tun?

    protected void SendMail()
    {
        var fromAddress = "[email protected]";
        var toAddress = "[email protected]";
        const string fromPassword = "mypassword";

        string subject = "New Email from Website";
        string body = "From: " + name.Text + "\n";
        body += "Email: " + email.Text + "\n";
        body += "Message: \n" + message.Text + "\n";

        var smtp = new System.Net.Mail.SmtpClient();
        {
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.EnableSsl = true;
            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
            smtp.Timeout = 20000;
        }
        //Passing values to smtp object
        smtp.Send(fromAddress, toAddress, subject, body);
    }
InformationsquelleAutor JAck28 | 2013-06-21
Schreibe einen Kommentar