Answer the question
In order to leave comments, you need to log in
Why are messages not delivered when sending from Yandex - EMail and are defined as spam?
Good afternoon!
The project has an email notification. When performing a certain action on the site, the user should receive a notification by EMail.
I implemented sending in C# through the Yandex mailbox.
But messages are defined as spam and do not reach the recipient.
Why is this happening and how to get around it? I tried to send from google - messages take too long to reach the recipient.
Here is what Yandex writes:
Code
using (MailMessage mail = new MailMessage())
{
MailAddress addrFrom = new MailAddress(_emailFrom, "Adaptive CRM");
MailAddress addrTo = new MailAddress(email, email);
mail.From = addrFrom;
mail.To.Add(addrTo);
mail.Subject = subject;
mail.Body = message;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
ContentType mimeTypeHtml = new System.Net.Mime.ContentType("text/html");
ContentType mimeTypePlain = new System.Net.Mime.ContentType("text/plain");
// Add the alternate body to the message.
AlternateView html = AlternateView.CreateAlternateViewFromString(message, mimeTypeHtml);
AlternateView plain = AlternateView.CreateAlternateViewFromString(message, mimeTypePlain);
mail.AlternateViews.Add(html);
mail.AlternateViews.Add(plain);
// Can set to false, if you are sending pure text.
//mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
//mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));
using (SmtpClient smtp = new SmtpClient(_smtpAddress, _portNumber))
{
smtp.Host = _smtpAddress;
smtp.Port = _portNumber;
smtp.EnableSsl = _enableSSL;
smtp.Credentials = new NetworkCredential(_emailFrom, _password);
try
{
smtp.Send(mail);
}
catch (Exception ex)
{
}
}
}
Answer the question
In order to leave comments, you need to log in
You need the sender's private domain, as well as SPF and DKIM DNS records.
PS Yandex mail for a domain supports both SPF and DKIM .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question