I wanna send a mail which formatted as html. I can do that but the mail comes wrong. When I open the source of the mail i saw that some of my styles and tags are removed but i do not know why. For example;
This is I want to send:
<div class="root-container">
<div class="section">
...
</div>
<div>
This is I received:
<div class="section">
...
</div>
This is my css style:
div.root-container {
padding: 1rem;
position: relative;
background: linear-gradient(to right, #13a455, #0a5ca4);
padding: 5px;
}
This is received style:
.ROOT-CONTAINER {
padding: 1rem;
background: linear-gradient(to right, #13a455, #0a5ca4);
}
C# Code:
var mail = new MailMessage();
mail.From = new MailAddress(accountContract.FromAdress, accountContract.FromName);
mail.Subject = messageContract.Subject ?? "";
mail.IsBodyHtml = true;
mail.Body = messageContract.Body;
using (var smtp = new SmtpClient())
{
try
{
smtp.Credentials = new NetworkCredential(accountContract.MailUser, accountContract.MailPassword);
smtp.Host = accountContract.Server;
smtp.Send(mail);
}
catch (SmtpException ex)
{
WriteLog(messageContract.MessageId, "SmtpClient", null, ex.ToString());
return MailStatus.UnProcessed;
}
}
I am trouble with that problem for days. I would be really appreciated it if you could help me.