smtpclient - C# receive error sending a email -


error: service not available, closing transmission channel. server response was: resources temporarily unavailable - please try again later

private void button1_click(object sender, eventargs e) {     string smtpaddress = "smtp.mail.yahoo.com";     int portnumber = 587;     bool enablessl = true;      string emailfrom = "mail@yahoo.com";     string password = "mailpass";     string emailto = "sendemail@yahoo.com";     string subject = "hello";     string body = "hello, i'm writing hi!";      using (mailmessage mail = new mailmessage())     {         mail.from = new mailaddress(emailfrom);         mail.to.add(emailto);         mail.subject = subject;         mail.body = body;         //mail.isbodyhtml = true;         // can set false, if 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.credentials = new networkcredential(emailfrom, password);             smtp.enablessl = enablessl;             smtp.send(mail);          }     } } 

what should do?

you need make sure external application has permission send emails through email before can proceed.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -