PC SMTP Problem

Page 1 of 1

3 Replies - 921 Views - Last Post: 29 November 2010 - 12:44 PM

#1 ramo1995   User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 38
  • Joined: 24-July 10

PC SMTP Problem

Posted 29 November 2010 - 10:48 AM

Hello,

First of all, this was supposed to pe a programming question ( in c# ). But I decided to post it in this forum for reasons I'll explain later.

Last week, I had created a program that sends an eamil through an SMTP server. The code worked all the time and didn't have any problems any time. Although you won't need the code, here it is:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Net;
using System.Net.Mail;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
                try
                {

                    MailMessage message = new MailMessage();
                    message.From = new MailAddress("[email protected]");
                    message.To.Add("[email protected]");
                    message.Subject = "afdasdfasfg";
                    message.Body = "Hgfk4564267862738I";
                    message.IsBodyHtml = true;
                    message.Priority = MailPriority.High;
                    SmtpClient sC = new SmtpClient("smtp.mail.yahoo.com");
                    sC.Port = 587;
                    sC.Credentials = new NetworkCredential("myid", "mypassword");
                    //sC.EnableSsl = true;
                    sC.Send(message);
                    MessageBox .Show ("Mail Send Successfully");
                    
                }
                catch (Exception ex)
                {
                    MessageBox .Show (ex + "Mail Sending Fail's") ;
                    
                }
            }
            
        }
    }
       



Now, as I said this worked perfectly until around four days ago when I just tried it and the program just threw up this error:


System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect
to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the
connected party did not properly respond after a period of time, or established connection failed because
connected host has failed to respond 64.202.165.58:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.
ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace
--- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async,
IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.
Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net
.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.
GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.
SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message)

Now, I know 100% that the problem is not with the code for two reasons:
1.The code worked perfectly for a whole week (I didn't change anything ).
2. Today, I tried the program on another computer at my school and it worked perfectly.

So basically, the problem is something with my computer because the program works fine on another computer. And, the program used to work on my computer for a whole week.

That's why I don't don't need any code help. Could someone explain all this to me. What could possibly be wrong with my computer. Please help ( very urgent).

Thanks for your help!

Is This A Good Question/Topic? 0
  • +

Replies To: PC SMTP Problem

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: PC SMTP Problem

Posted 29 November 2010 - 10:51 AM

Does the SMTP server respond to other programs, other than your custom one?

You can't force a server to respond. If the request is timing out, it's timing out. The server could be ignoring you, or it could be down.
Was This Post Helpful? 0
  • +
  • -

#3 ramo1995   User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 38
  • Joined: 24-July 10

Re: PC SMTP Problem

Posted 29 November 2010 - 10:58 AM

View Postno2pencil, on 29 November 2010 - 09:51 AM, said:

Does the SMTP server respond to other programs, other than your custom one?

You can't force a server to respond. If the request is timing out, it's timing out. The server could be ignoring you, or it could be down.



Hi @no2pencil.
How can I know if the SMTP server respond to other programs other than mine? Is there a special test I can do or something?
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: PC SMTP Problem

Posted 29 November 2010 - 12:44 PM

You can use a standard SMTP client such as outlook or Thunderbird. How did you troubleshoot your code if you didn't already have a working account with a working SMTP client?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1