M
M
mindgrow2018-04-23 12:40:57
C++ / C#
mindgrow, 2018-04-23 12:40:57

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:
5addaa43779ed492674483.png
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

2 answer(s)
A
Alexander Yudakov, 2018-04-23
@mindgrow

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 .

E
Evgeniy Ivanov, 2019-02-17
@cpanelhostig

You need to configure SPF, DCIM, DMARC.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question