Hey guys, I'm trying to set up an email sending application using a hotmail account. The code looks like this:
MailMessage Mail = new mailmax (from, to); Mail.Subject = "problem 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"); By using , I have not really received any error, I also get a response that the message has been sent (event trigger) but the message never comes. If I use simple clients. Invalid zero, I get the following error:
5.3.4 The requested action was not taken; To continue sending messages, please sign in to your account.
So what can be the problem? As soon as I was trying to hand over the SMTP setting of Hotmail, I got many setups saying port 25, then 587, maybe it's something like any help would be greatly appreciated thanks!
- Okay, this is definitely working now, I just want to ask that I have to do regularly "I'm not checking the robot" or once is?
This is my setup, BTW Async will not return any errors.
& lt; System.net & gt; & Lt; MailSettings & gt; & Lt ;! - Email server settings - & gt; & Lt; Smtp from = "do-not-reply@example.com" & gt; & Lt; Network host = "smtp.example.com" port = "25" userName = "" password = "" default credentials = "true" /> & Lt; / Smtp & gt; & Lt; / MailSettings & gt;
Zero SendEmail (email address email) {var mail message = new mailmessage {from = new mail order (from email.fr)}; MailMessage.To.Add (new mail address (email. To)); MailMessage.Subject = email.Subject; MailMessage.Body = email.Body; MailMessage.IsBodyHtml = True; // Send email var client = new SmtpClient (); Client.Send (MailMessage); }
Comments
Post a Comment