Port 25 SMTP issues

Discussion in 'Email' started by patrick24601, Dec 15, 2009.

  1. Is SMTP running on any additional ports besides 25? For years Cox has blocked sending out anything to port 25 that is not on their network. At some of the linux hosting companies I work with they are familiar with this and run on port 25 and 26.

  2. ...I think 587 works with some providers.
  3. Ray


    Yes 587 is open as the backup smtp port. But realistically you should be using your ISP's SMTP server to send out email. It should not affect how you receive emails from other hosting companies.
  4. I'd like to - but I test here with theirs, and then when I go live I have to switch to yours. Was looking for just one to make it easier on me.

    So the better question may be - via code (C#) what is a good way to determine the name of the server I am on? I can probably make this automatic if I can determine that.
  5. Ray


    Check your Winhost control panel under Domain Manager to find the name of the mail server your account will use. If you are going to use a web application to send out email and you upload that web application to our server you will be able to use port 25. We do not block port 25 on our end.
    Last edited by a moderator: Oct 14, 2015
  6. Ray,

    When I am testing locally I need/should be using my local one. WHen I am on your server I should be using yours. What I'd like to do is autosense what server I am running on to switch this automatically in code. Any idea what C# function I can use to determine the server I am running (mypc or yourserver). I'll go google it too.
  7. Ray


    Not sure if you can create a condition for this in your web application, but I do recommend that you go ahead and use our SMTP server. The reason being is that our SMTP server requires smtp authentication. I'm not sure about your localhost, but if you really want to test your web application then passing the smtp authentication will give you a more accurate result. Plus it'll reduce the amount of coding you'll need to change once you upload the web application to our server. Just specify port 587 and it should work.
  8. Interesting. Worked and sent email from my machine. But when I uploaded it to the server it failed with:

    [SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
    System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
    System.Security.CodeAccessPermission.Demand() +58
    System.Net.Mail.SmtpClient.Initialize() +128
    System.Net.Mail.SmtpClient..ctor(String host, Int32 port) +220

    Code is:

    MailAddress from = new MailAddress("info@mydomain.com", "My Domain Support", System.Text.Encoding.UTF8);
    MailAddress to = new MailAddress(toaddress);
    MailMessage msg = new MailMessage(from, to);

    NetworkCredential streetcred = new NetworkCredential("mailer@mydomain.com", "emailpassword");

    // Add a standard signature
    string sig = "Email Signature";

    msg.Body = String.Concat(emailbody,sig);
    msg.BodyEncoding = System.Text.Encoding.UTF8;
    msg.IsBodyHtml = true;
    msg.ReplyTo = new MailAddress("info@mydomain.com");

    msg.Subject = subj;
    msg.SubjectEncoding = System.Text.Encoding.UTF8;

    SmtpClient client = new SmtpClient(GetSMTPServer(),587);
    client.Credentials = streetcred;

    GetSMTPServer() returns "mail.mydomain.com"
  9. Ray


    Last edited by a moderator: Oct 14, 2015
  10. This has solved my issue. Thanks for the prompt help.

Share This Page