string to = "[email protected]"; string body = "Test"; SmtpClient SMTPServer = new SmtpClient("127.0.0.1"); MailMessage mailObj = new MailMessage(urEmail, to, subject, body); SMTPServer.Send(mailObj);
This is how i am currently sending a test email. How do i make this html and be able to make the email sent out look better by adding images etc?
Thanks
Instances of the MailMessage class are used to construct email messages that are transmitted to an SMTP server for delivery using the SmtpClient class. The sender, recipient, subject, and body of an email message may be specified as parameters when a MailMessage is used to initialize a MailMessage object.
IsBodyHtml states that your message is HTML formatted. If you were only sending a single view of HTML, this is all you need.
On the MailMessage
set the property IsBodyHtml
to true.
string to = "[email protected]"; string body = "Test"; SmtpClient SMTPServer = new SmtpClient("127.0.0.1"); MailMessage mailObj = new MailMessage(urEmail, to, subject, body); mailObj.IsBodyHtml = true; // This line SMTPServer.Send(mailObj);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With