smtp with ASP.Net Development Server

Discussion in 'ASP.NET / ASP.NET Core' started by spookyfriday, Nov 2, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello

    I am running my site locally under the development server and attempting to send a test message against my smtp server listed in my Hosting Control Panel smtp.MySiteName.com, every time I get a send failure because the connection was actively refused, is this simply because I am runnign locally?
    I've triple checked the server name, uid and password and all are fine, initially I was trying with no credentials.

    MailMessage msg = new MailMessage(from,to)
    msg.Subject = subject;
    msg.Body = "hi there";
    msg.Attachments.Add(new Attachment(filePath));

    SmtpClient smtp = new SmtpClient("smtp.MySiteName.com");
    smtp.Credentials = new NetworkCredential("uid", "pwd");
    smtp.Send(msg);

    Thank you for your time and ideas,
    Patrick
     
  2. dmitri

    dmitri DiscountASP.NET Staff

    It could be that your ISP is blocking the default smtp port 25. It is a common practice of many ISP's to block this port without any notice. Please try to force your application to use the alternative port 587 which we provide for such circumstances. If port 587 still does not work, try to disable temporarily your antivirus/firewalls software to see if they are blocking ports locally.
     
  3. Since you're running your application locally, are you able to reach your SMTP server from your local network? Try doing a telnet and see if you're able to reach it.

    To do a telnet, you can do the following:
    1. Click on the Start button, and select Run..
    2. On the Open field, type in "CMD" and hit OK.
    3. In the Command Prompt, type "telnet smtp.DOMAINNAME.com 25".
     
  4. Hello

    Thank you all for your replies, I tried the telnet approach and was unable to access the server using either port, unfortunatly I can't disable my antivirus due to our MIS rules. You are thinking that this should work just fine?

    Thanks,
    Patrick
     
  5. Try the telnet using port 587. This alternative port usually works, and you just have to change your app to use this port in your local environment.
     
  6. Hi Jose

    Thank you, I tried that one at the same also in my last attempts, still get denied every time. Can you see anything on your side where I am being denied?

    Thank you,
    Patrick
     
  7. I suppose we could check, but it's nothing we can do through the forum. You'd have to write to support directly for this type of information.

    If you can't telnet however, it's likely to be a problem on your end as you're not able to reach the mail server through the port. Are you even able to ping it or do a traceroute?
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page