Reputation: 360
I don't have a clue any more, what I did wrong. I try to send an Email by Code. I am using C# with VS2010. Here is my code:
SmtpClient smtpClient = new SmtpClient();
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "MyPass");
smtpClient.Port = 465;
smtpClient.Host = "smtp.strato.de";
smtpClient.EnableSsl = true;
//Setting From , To and CC
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected] ", "MyAdminsMail");
mail.To.Add(new MailAddress("[email protected]"));
mail.Body = "test";
mail.Subject = "E-mailtest";
smtpClient.Send(mail);
Every time I get a timeout within the last Code line. I have got a working Internet connection. The Email Address works fine within Outlook (sent/receive). And the following Code:
Sender.Send("smtp.strato.de");
return with a success with a RoundtripTime of 27.
what is the reason for failing?
Upvotes: 2
Views: 2466
Reputation: 11731
make a try using port 587 and the reason you can see in below image:
Upvotes: 4