There are all kinds of checks that you could do. You could try to ping the host (Net::Ping) and see if that works - although that doesn't test that port 25 is open. You could try to connect to port 25 - but that doesn't guarantee that it's actually a mail server listening, or that your connection hasn't been redirected to the ISP's mail server (which might require SMTP Auth, limit who you can send as, etc).

I would think that the only safe, robust way of checking would be to send a test email from the user to themselves, and include some kind of id in the body so that you know that it's been sent properly. You can then immediately delete that email once you see it. This will allow you to test both their SMTP and POP/IMAP settings at the same time, and uses modules that you've probably got installed anyway, rather than introducing something new.


In reply to Re: Checking SMTP ports. by dtr
in thread Checking SMTP ports. by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.