Welcome Guest, Not a member yet? Register   Sign In
Detect if the email sent bounced.
#1

[eluser]basty_dread[/eluser]
Hello, is there a way to know if the email that I sent using codeigniter email library bounced?
#2

[eluser]smilie[/eluser]
Hi,

As far as I know, (almost) any e-mail (PHP) function only sends e-mail to the outgoing server. And there it 'stops'. So, to check for bounced mail, you would need to do one of two things:

1. To check if mail would be accepted before you send it; for this, you will have to do a couple of things:
- get the receiving e-mail server (from DNS MX records);
- open connection to it and send command RCPT TO: $email;
If the response says OK - then that e-mail address accepts e-mails for that e-mail account;
Otherwise, response would be something like "e-mail address not recognized or what else"...

2. Second options is afterwards; meaning, you send e-mail with CI lib as usual, but afterwards you check the mailbox which has sent e-mail if it has received failure message. For this you will have to 'POP' the mailbox and parse e-mails in it, looking for the 'failed' message. Main disadvantage is the fact that 'failed' message can come as long as 48 hours later on... In the first case you know forehand if it will work or not.

In both cases, you will have to extend the e-mail lib.

Cheers,
Smilie
#3

[eluser]basty_dread[/eluser]
Any other suggestions? where can I find this DNS MX Records?
Thanks For the reply Big Grin
#4

[eluser]smilie[/eluser]
MX records, for example through exec() (PHP) command, which is by the way on most shared servers forbidden / disabled:

exec('dig domain.com mx');

Cheers,
Smilie
#5

[eluser]TWP Marketing[/eluser]
I'm using this as part of the code to verify an email address. The $isValid var is a flag used by several other tests of the email address itself. This code checks the domain if you extract it from the address. This is all php code and solves part of your problem. It does NOT check the mailbox for existence, only the domain.

Code:
if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))){
    // domain not found in DNS
    $isValid = false;
   }
#6

[eluser]basty_dread[/eluser]
Thanks, I guess this will work, Thanks a lot.




Theme © iAndrew 2016 - Forum software by © MyBB