Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Sendmail to non-working email address

by blue_cowdawg (Monsignor)
on Sep 04, 2003 at 17:14 UTC ( [id://288927]=note: print w/replies, xml ) Need Help??


in reply to Sendmail to non-working email address

Having solved this issue a time or three let me share some thoughts with you:

Is this address valid?

First off consider looking at Email::Valid. This module will do two things for you. First it will check to see if the address is well formed. Seondly it checks to see if there is a mail server for the domain part. Example:

--$ perl -MEmail::Valid printf "%s\n",(Email::Valid->address("peter\@berghold.net")?"Yes":"no" +); Yes --$ perl -MEmail::Valid printf "%s\n",(Email::Valid->address("peter@yuckster.com")?"Yes":"no") +; no --$ host yuckster.com yuckster.com has address 216.21.229.209 --$ host -tany yuckster.com yuckster.com name server dns21.register.com. yuckster.com name server dns22.register.com. yuckster.com has address 216.21.229.209

With that information in hand I can go to the next step in validating this user's email address.

But do they have a valid account at that address?

Here is here I get really clever. (well... maybe not that clever..) First some assumptions:

  1. I have an RDBMS I can shove info into or a reasonable facimile
  2. I can generate unique keys for the user's email address and a link to a page to validate that unique key
After recording the key and email address somewhere for my validation script to find it I send the user an email that will have a key and a link to a page. I will either have the user type in the key (yuck!) or I will provide them with a link to a CGI script that takes the email address and key as parameters to be validated. The URL that I email them will look something like:
http://my.server.com/cgi-bin/validate.cgi?key=oiweruojaklsdfklh&email= +dude@isp.com

Now you have validated that the email address is valid AND you have validated that it exists... Like it? There is more than one way to do this, but this is one of them.


Peter L. Berghold -- Unix Professional
Peter at Berghold dot Net
   Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://288927]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-18 04:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found