By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

unavailable email question

P: n/a
Hi all,

we have many people that have registered to our newsletter and we are
getting every time more people who the email is unavailable. It's there any
technique to detect such unavailable address ?

We tought about using a special email (like ne********@ourdomain.com) then
using a PHP script to catch the returning email and catch some text on them
and decide if we remove the address from our mailing list or not. It's
possible with PHP ? It is the best solution ?

Thanks for answering.

Bob
Dec 18 '07 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Bob Bedford wrote:
Hi all,

we have many people that have registered to our newsletter and we are
getting every time more people who the email is unavailable. It's there any
technique to detect such unavailable address ?

We tought about using a special email (like ne********@ourdomain.com) then
using a PHP script to catch the returning email and catch some text on them
and decide if we remove the address from our mailing list or not. It's
possible with PHP ? It is the best solution ?

Thanks for answering.

Bob
Sure, it's possible with PHP, and quite workable. Whether it's the best
solution only you can decide.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Dec 18 '07 #2

P: n/a
On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.
Dec 18 '07 #3

P: n/a
On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:
On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
>You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.
... which you can add yourself in the code or as last item to the returned
MX records if none exist/can be found. If you code with that fallback in
mind, I see no reason why you couldn't(/shouldn't from a technical
standpoint, load is something else) write a script that makes use of this
function to validate an emailaddress. True, it cannot be done by this
function _alone_, that's what IMHO this note is about.
--
Rik Wasmus
Dec 18 '07 #4

P: n/a

"Rik Wasmus" <lu************@hotmail.coma écrit dans le message de news:
op***************@metallium.lan...
On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:
>On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
>>You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.

.. which you can add yourself in the code or as last item to the returned
MX records if none exist/can be found. If you code with that fallback in
mind, I see no reason why you couldn't(/shouldn't from a technical
standpoint, load is something else) write a script that makes use of this
function to validate an emailaddress. True, it cannot be done by this
function _alone_, that's what IMHO this note is about.
--
Rik Wasmus
Fantastic !!!!
This way an email address may be checked when a user register, right ?
I don't know what MX is, so I've to get on Internet a little bit to
understand what does this function. Also thanks for the link, that is
perfect for starting.

Maybe you can save me a lot of time searching: cant this function return an
unavailable mailbox but that does actually really exist ?

Cheers and thank you again.

Bob
Dec 18 '07 #5

P: n/a
Sure, it's possible with PHP, and quite workable. Whether it's the best
solution only you can decide.
Hi Jerry,

thanks for the anser,

the best solution I can decide for is with my knowledge only. You can see on
other responses that it seems to be a better solution that I didn't know.
Usually there is a better way if somebody know an other method. So asking if
it's the best way is usually to ask people having more experience if there
is a better one and in this case it seems there is.

Bob
Dec 18 '07 #6

P: n/a
Rik Wasmus wrote:
On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:
>On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
>>You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.

.. which you can add yourself in the code or as last item to the
returned MX records if none exist/can be found. If you code with that
fallback in mind, I see no reason why you couldn't(/shouldn't from a
technical standpoint, load is something else) write a script that makes
use of this function to validate an emailaddress. True, it cannot be
done by this function _alone_, that's what IMHO this note is about.
Rik,

Because the check is not reliable. It is perfectly possible for the a
check like this to succeed but the mail still be bounced, for instance -
i.e. when the main mail server is just a mail proxy and passes the
message on to others to handle. In this case the proxy may accept
everything and later the "real" server can reject it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Dec 18 '07 #7

P: n/a
On Tue, 18 Dec 2007 14:29:27 +0100, Bob Bedford <bo*@bedford.comwrote:
"Rik Wasmus" <lu************@hotmail.coma écrit dans le message de
news:
op***************@metallium.lan...
>On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:
>>On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.

.. which you can add yourself in the code or as last item to the
returned
MX records if none exist/can be found. If you code with that fallback in
mind, I see no reason why you couldn't(/shouldn't from a technical
standpoint, load is something else) write a script that makes use of
this
function to validate an emailaddress. True, it cannot be done by this
function _alone_, that's what IMHO this note is about.
Fantastic !!!!
This way an email address may be checked when a user register, right ?
I don't know what MX is, so I've to get on Internet a little bit to
understand what does this function. Also thanks for the link, that is
perfect for starting.

Maybe you can save me a lot of time searching: cant this function return
an
unavailable mailbox but that does actually really exist ?
Indeed it can, all sorts of network problems/time-outs/other stuff can
occur. That is why most servers will keep an 'undeliverable' message in a
queue, and periodically retry to send it before giving up. The way to
deploy it here would in my opinion be to flag a mailaddress as
unavailable, and only after repeatedly being flagged unavailable without a
success in between, flag it for possible deletion after a considerable
period of time (anything less then one day would be ridiculous, with some
slow DNS changes I would not recommend to set it lower then 3 days).

In my opinion, this is therefor unsuitable for email-validation when a
user registers (allthough it would probably work 99% or more of the time).
--
Rik Wasmus
Dec 18 '07 #8

P: n/a
On Tue, 18 Dec 2007 15:13:02 +0100, Jerry Stuckle
<js*******@attglobal.netwrote:
Rik Wasmus wrote:
>On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:
>>On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later

See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.
.. which you can add yourself in the code or as last item to the
returned MX records if none exist/can be found. If you code with that
fallback in mind, I see no reason why you couldn't(/shouldn't from a
technical standpoint, load is something else) write a script that makes
use of this function to validate an emailaddress. True, it cannot be
done by this function _alone_, that's what IMHO this note is about.

Because the check is not reliable. It is perfectly possible for the a
check like this to succeed but the mail still be bounced, for instance -
i.e. when the main mail server is just a mail proxy and passes the
message on to others to handle. In this case the proxy may accept
everything and later the "real" server can reject it.
Hmm, true, hadn't thought about 'accept everything' proxies...
--
Rik Wasmus
Dec 18 '07 #9

P: n/a
Indeed it can, all sorts of network problems/time-outs/other stuff can
occur. That is why most servers will keep an 'undeliverable' message in a
queue, and periodically retry to send it before giving up. The way to
deploy it here would in my opinion be to flag a mailaddress as
unavailable, and only after repeatedly being flagged unavailable without a
success in between, flag it for possible deletion after a considerable
period of time (anything less then one day would be ridiculous, with some
slow DNS changes I would not recommend to set it lower then 3 days).

In my opinion, this is therefor unsuitable for email-validation when a
user registers (allthough it would probably work 99% or more of the time).
--
Rik Wasmus
Thanks for informations Rik,

the email-validation would only be a "check". If it fails I may ask the user
to check again his email as the validation failed and then when he validate
again the address I save it. That's only for removing some mistyped emails
(even if I put 2 boxes and ask to write the email twice there is lot of
people typing email with errors).

I think I'll check the "undeliverable" email every month using only the
"undeliverable" emails.

Thank you again.

Bob
Dec 19 '07 #10

P: n/a

"Rik Wasmus" <lu************@hotmail.coma écrit dans le message de news:
op***************@metallium.lan...
On Tue, 18 Dec 2007 15:13:02 +0100, Jerry Stuckle
<js*******@attglobal.netwrote:
>Rik Wasmus wrote:
>>On Tue, 18 Dec 2007 13:35:13 +0100, Captain Paralytic
<pa**********@yahoo.comwrote:

On 18 Dec, 12:26, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
You could set up a cron job testing for the following:
- find the MX record for the domain
- try a RCPT TO in a socket connection
- flag emailaddres as unavailable on error
- decide your logic wether to delete the emailaddres or recheck it
(perhaps a limited number of times) later
>
See the comments at:
<http://nl2.php.net/manual/en/function.getmxrr.php>
More improtantly see the Notes:
Note: This function should not be used for the purposes of address
verification. Only the mailexchangers found in DNS are returned,
however, according to >RFC 2821 when no mail exchangers are listed,
hostname itself should be used as the only mail exchanger with a
priority of 0.
.. which you can add yourself in the code or as last item to the
returned MX records if none exist/can be found. If you code with that
fallback in mind, I see no reason why you couldn't(/shouldn't from a
technical standpoint, load is something else) write a script that makes
use of this function to validate an emailaddress. True, it cannot be
done by this function _alone_, that's what IMHO this note is about.

Because the check is not reliable. It is perfectly possible for the a
check like this to succeed but the mail still be bounced, for instance -
i.e. when the main mail server is just a mail proxy and passes the
message on to others to handle. In this case the proxy may accept
everything and later the "real" server can reject it.

Hmm, true, hadn't thought about 'accept everything' proxies...
--
Rik Wasmus
This will anyway reduce the number of really undeliverable email as this is
actually the main problem. The opposite would be a harder problem (telling
is not available and in fact it is)....as we would delete such address and
the customer want to receive our newsletter.
Anyway we are aware that there is no magic way to know if an email is still
active or not but we may use the 2 solutions to check it (MX and also
analyse the returned emails).

Thank you
Dec 19 '07 #11

P: n/a
Bob Bedford wrote:
We tought about using a special email (like ne********@ourdomain.com)
then using a PHP script to catch the returning email and catch some text
on them and decide if we remove the address from our mailing list or
not. It's possible with PHP ? It is the best solution ?
ourdomain.com is a real domain name owned by Eurobox Ltd, St Petersburg.
If you're not affiliated with that company, then you should probably stop
including their e-mail address in your posts -- they might not appreciate
it. Domains example.org, example.com and example.net are registered
specifically for the purpose of providing examples -- use them.

Now, on to your question: include whatever From address you like. The
trick is in the "Return-Path" header. What you do is take the user's e-
mail address and massage it a bit to add a return path header to your
message:

$my_domain = 'example.com';
$their_address = 'f***@example.org';
$return_path = 'newsletter+'
. str_replace('@', '=', $their_address)
. '@' . $my_domain;
$headers .= "Return-Path: $return_path";

Now, if fr**@example.org's mail bounces, the error message should get sent
to "ne*************************@example.com". Most mail servers will by
default treat this as an alias for "ne********@example.com". If not, this
feature can normally be enabled using the mail server's "VERP" setting.

Now you can write a script to periodically scan through the incoming mail
for ne********@example.com, pick out "To" addresses that match the regular
expression "/^newsletter\+/i" and then transform them to determine the
problem e-mail account:

$to_addr = 'ne*************************@example.com';
if (preg_match('/^newsletter\+/i'))
{
$to_addr = preg_replace('/^newsletter\+/i', '', $to_addr);
list($to_addr, $dummy) = explode('@', $to_addr);
$at_pos = strrpos($to_addr, '=');
$to_addr[$at_pos] = '@';
echo "Bounce from $to_addr\n";
}

Now you might not want to instantly unsubscribe this person from the
mailing list. Sometimes e-mail addresses temporarily start to bounce, e.g.
the user's mailbox has gone overquota, but starts working again once they
delete a few large attachments.

An idea might be to simply record all bounces into your database so that
you can unsubscribe (or perhaps, "put on hold") contacts who have, say,
bounced more than four times in the last two months (the exact criteria
are up to you!). If they are important customers you could phone them up
to ask them to confirm which is the best e-mail address for you to send
the newsletter to.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 12 days, 23:15.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
Dec 20 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.