OK - the problem here is that you're underestimating the complexity of what you're asking.

First of all, you cannot guarantee that you can get to the authoritative mail server for someone's email from the internet. For example, they may run an e-mail gateway which does virus checking before forwarding onto the real mail server (like messagelabs, or a home grown equivelant), their main mail server may be down, and you'll get through to a backup mail server (a temp spool only, which forwards to the primary e-mail server once it comes back online), or maybe others!

Secondly, piping out to sendmail will return success if sendmail accepts the message - not if sendmail can deliver it. If sendmail cannot deliver the message, it'll give up later, and send a DSN to the sender (you wouldn't want to wait until sendmail times out before continuing in your code, would you :)

In short, you have two options:-

  1. Attempt to deliver the message, set the from address to somehting that'll get delivered back to a POP account, and use Net::POP to check the POP account for DSNs or other failures (RFC-1894 is your friend here)
  2. Send the member an e-mail address before enabling their account. If they click on a link in the e-mail (include their user-id, and some authentication details), they call a CGI which will then enable their account

I personally think that (2) is the safest, easiest, and most reliable, as long as you're willing to run a nightly cron job to clear out any old accounts that haven't been activated within X days.


In reply to Re: Sendmail to non-working email address by dtr
in thread Sendmail to non-working email address by true

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.