I am trying to setup an email sending application, using a hotmail account.
The code looks like this:
MailMessage mail = new MailMessage(from, to);
mail.Subject = "Proba email";
mail.Attachments.Add(new Attachment("C:\\Documents and Settings\\Proba.txt"));
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Port = 587; // 465 568
client.Host = "smtp.live.com";
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("smg@hotmail.com", "password");
client.SendCompleted += new SendCompletedEventHandler(client_SendCompleted);
client.SendAsync(mail, "token");
Using, Async I actually get no errors, I even get the feedback saying message sent (Event triggers) but the message never arrives. If I use the simple client.Send void, I get the following error:
5.3.4 Requested action not taken; To continue sending messages, please sign in to your account.
So any ideas on what the problem can be? As I was trying to hand down the SMTP settings of hotmail I got various setups saying port 25, then 587 so maybe it's something there. Any help would be greatly appreciated thanks!
- Okay so it's definitely working now, I would just like to ask if I will have to do regular "I'm not a robot checks" or was that a one-time thing?