in reply to Sendmail to non-working email address

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.

  • Comment on Re: Sendmail to non-working email address