[imp] IMP 2.3 address books

Lic. Rodolfo Gonzalez Gonzalez rodolfo@equinoxe.g-networks.net
Mon, 8 Oct 2001 12:35:13 -0600 (CST)


---------------------- multipart/mixed attachment
On Mon, 8 Oct 2001, Chuck Hagenbuch wrote:
> How do you propose to validate email addresses?

I'm attaching a PHP class by Manuel Lemos which does it. It returns
values corresponging to "not valid", "maybe valid" and "valid". It has
worked for me. It could be just informative, or if using a kind of "strict
mode", it could allow or deny sending e-mail to the address, as you wish.

Regards,
Rodolfo.


---------------------- multipart/mixed attachment
PD8NCi8qDQogKiBlbWFpbF92YWxpZGF0aW9uLnBocA0KICoNCiAqIEAoIykg
JEhlYWRlcjogL2N2c3Jvb3QvUEhQbGlicmFyeS9lbWFpbF92YWxpZGF0aW9u
LnBocCx2IDEuNSAxOTk5LzEyLzE4IDIwOjMwOjMzIG1sZW1vcyBFeHAgJA0K
ICoNCiAqLw0KDQpjbGFzcyBlbWFpbF92YWxpZGF0aW9uX2NsYXNzDQp7DQog
dmFyICRlbWFpbF9yZWd1bGFyX2V4cHJlc3Npb249Il4oW2EtejAtOV9dfFxc
LXxcXC4pK0AoKFthLXowLTlfXXxcXC0pK1xcLikrW2Etel17Miw0fVwkIjsN
CiB2YXIgJHRpbWVvdXQ9MDsNCiB2YXIgJGxvY2FsaG9zdD0iIjsNCiB2YXIg
JGxvY2FsdXNlcj0iIjsNCg0KIEZ1bmN0aW9uIEdldExpbmUoJGNvbm5lY3Rp
b24pDQogew0KICBmb3IoJGxpbmU9IiI7OykNCiAgew0KICAgaWYoZmVvZigk
Y29ubmVjdGlvbikpDQogICAgcmV0dXJuKDApOw0KICAgJGxpbmUuPWZnZXRz
KCRjb25uZWN0aW9uLDEwMCk7DQogICAkbGVuZ3RoPXN0cmxlbigkbGluZSk7
DQogICBpZigkbGVuZ3RoPj0yDQogICAmJiBzdWJzdHIoJGxpbmUsJGxlbmd0
aC0yLDIpPT0iXHJcbiIpDQogICAgcmV0dXJuKHN1YnN0cigkbGluZSww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