Click here to Skip to main content
11,790,021 members (48,369 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hey Guys,

i am trying to send email using and i got this SMTPException:

Failure sending mail.
{"Unable to read data from the transport connection: net_io_connectionclosed."}

and Her is My Code:

            //YAHOO SMTP Host (
            //GMAIL SMTP Host (
            //WINDOWS LIVE SMTP HOST (
            SmtpClient mySmtpClient = new SmtpClient("", 25);
            // set smtp-client with basicAuthentication
            mySmtpClient.UseDefaultCredentials = false;
            System.Net.NetworkCredential basicAuthenticationInfo = new
               System.Net.NetworkCredential("myEmail", "myPassword");
            mySmtpClient.Credentials = basicAuthenticationInfo;
            // add from,to mailaddresses
            MailAddress from = new MailAddress("From_Email", "Title");
            MailAddress to = new MailAddress("To_Email", "Test Email");
            MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
            // set subject and encoding
            myMail.Subject = Email_Subject;
            myMail.SubjectEncoding = System.Text.Encoding.UTF8;
            // set body-message and encoding
            myMail.Body = Email_Body;
            myMail.BodyEncoding = System.Text.Encoding.UTF8;
            // text or html
            myMail.IsBodyHtml = true;
            return true;
        catch (SmtpException ex)
            return false;
        catch (Exception ex)
            return false;

Any Ideas????????????
Posted 12-May-13 2:40am
ThePhantomUpvoter at 12-May-13 8:46am
Not every SMTP server uses the default port 25.
AmrDeif at 12-May-13 8:56am
so what should i do???
AmrDeif at 13-May-13 8:14am
Someone tell me what to do PLZ!!!!!

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The Yahoo SMTP port is 465, not 25.

You also need EnableSsl set to true on the SmtpClient object.
AmrDeif at 13-May-13 5:19am
Thanks Dave Kreskowiak for Your Reply
I've tried this but it didn't work
i've the same error
Unable to read data from the transport connection: net_io_connectionclosed
Dave Kreskowiak at 13-May-13 12:54pm
The SmtpClient only supports one of the two SSL authentication methods available. Try disabling SSL and using port 587 instead.

Oh, and I'm seeing that you might need a Yahoo Plus account to use the SMTP servers.
AmrDeif at 15-May-13 8:21am
the application sends emails and the email i send from (sender) is not valid after a number of right sending???
why is this?
does yahoo suspend email that sends more emails???
Dave Kreskowiak at 15-May-13 8:24am
I have no idea what you mean by "is not vlaid after a number of right sending". That makes no sense.

But, if you mean you can no longer send emails, yes, you cannot use Yahoo for bulk mail. I don't know what the limit is per day. You will have to contact Yahoo Support for that information or whatever service they offer for such, if any.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 1,029
1 Maciej Los 790
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 460

Advertise | Privacy | Mobile
Web04 | 2.8.1509028.1 | Last Updated 12 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100