S
S
Sasha Pleshakov2016-03-13 21:04:40
ASP.NET
Sasha Pleshakov, 2016-03-13 21:04:40

SMTP. Why e.Message = Operation timed out?

try
        {
            WebMail.SmtpServer = "smtp.yandex.ru";
            WebMail.SmtpPort = 465;
            WebMail.EnableSsl = true;
            WebMail.UserName = "s.endmail";
            WebMail.Password = "[email protected]$w0rd";
            WebMail.From = "[email protected]";
 
            WebMail.Send("[email protected]", "RSVP Приглашение",
                Model.Name + ((Model.WillAttend ?? false) ? "" : "не") + "придет");
        }
        catch (Exception e)
        {
            @:<b>К сожалению при отправке письма возникла ошибка.</b>
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
akass, 2016-03-13
@mnepoh

I had the same problem, I tried with different mails, I found out that most mailers turned off access to smtp from third-party programs, except for a few mailers.
It is necessary to take your own, it usually goes to hosting.

D
Dmitry Eremin, 2016-03-14
@EreminD

And it's better to use SendAsync

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question