How to check email addresses in Unix

All,

I’m trying to write a shell-script that’ll check all the email addresses in our databases to make sure that they’re deliverable. I’ve tried ‘sendmail -bv user@host.com’ but no matter what, it says the address is deliverable. The other options, mail and mailx don’t seem to have an option at all.
Any help? Thanks. This is on Solaris 2.7.

I’ve checked other boards,books and called a few friends no answer seems in sight. Are there any guru’s out there?

I don’t think the task can be done the way you want it to be done.

Since you are testing for email addresses that are external to your system, unix has to send the email out for delivery. What you will get back immediately is that unix was able to hand the mail over to the internet. If the mail is undeliverable, the sender will eventually get an email to that effect.

What you probably need to do is get a process to trap/parse those emails and communicate back to the database which email addresses are bad. That I don’t know how to do.

[sup]I sincerely hope you aren’t doing this to spam people[/sup]

Theoretically, the way to do this is to connect to the remote mail server and use the VRFY SMTP command to check the address. Unfortunately, most mail servers don’t respond in any useful way to VRFY. Some will respond in the affirmative to pretty much any syntactically valid address at their domain. Some just don’t allow you to VRFY anything.

The only way to really know whether an address is valid is to send mail to it and see what happens.

I’m not doing this for spam. My databases have become filled with invalid email addresses. I’m just trying to find a way to clean these out without going through a costly manual routine.

Thanks for the responses. I didn’t think it would be easy to do.