Failed sending email :: PHP :: DEBUG MODE Line : 234 File : emailer.php
What causes this?
If this has worked for you before, and you suddenly start seeing the above mentioned error message, chances are that one (or more) of the email adresses you're trying to send to is (no longer) a reachable email address.(The forum tries to send post notifications to forum users who subscribed ('watch this topic') to a certain topic)
(Note, even in the case of a bad email address causing this error, the notification is still being sent to all the 'correct' email addresses)
What is the most obvious solution
Find the offending email address and either correct it or remove it.What is a more permanent, yet simple, solution?
The 'obvious' solution has two drawbacks::- It may not be so simple to find the offending email address
- When fixed, the next time an email address 'goes bad', you'll get that same error message again
Just ignore the result of php's mail function! You simply don't care whether people's email addresses are good or bad!
To do this, follow the following simple steps:
- Use FTP to download the file emailer.php from your server: it's in the 'includes' directory of your forum installation
- Open it in an editor and simply put two slashes (//) in front of line 234
- Save the file, close it, and upload it to its original location ('includes' directory!) ... problem solved
What is a slightly more elegant solution?
Instead of adding two slashes, move the whole 'if' block between comment directives (/* */), like this:/* // Did it work? if (!$result) { message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__); } */
What is an even more advanced, yet simple, solution?
Fixing the offending enail address doesn't prevent the error from popping up again the next tine an email address goes bad. Also, which email address is it?But just preventing the error message, however, leaves you unaware of bad email addresses.
The next, more advanced (but still simple) solution helps with both:
- It suppresses the error message
- It sends the forum administrator an email with a list of all the email addresses that were being used
// Did it work? if (!$result) { $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\n"; $result = @mail( $board_config['board_email'], "Forum bad email addresses", "List of email addresses: at least one is unreachable!\n\n" . "to: ".$to."\n\n".(($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''), $this->extra_headers); }Or download the entire patched emailer.php file HERE (select 'Emailer').
Note: the above download is compatible with phpBB versions 2.0.18 to 2.0.22. If you have something older ... consider upgrading first!
Did this fix your problem?
Tell me about it!Read other people's comments
Disclaimer
Bad email addresses may not be the only cause for the infamous 'Line: 234' error. But it IS the most common cause, ESPECIALLY when this used to work fine for you. If you verified all email addresses and they are all correct, check your 'From' address: most hosters mandate the From address to be in the same domain that you're sending from. (They may just have changed their policy!)And then there is, of course, always the slight chance, that there IS something wrong with your hoster's mail functionality. But your best bet is: a 'bad' email address is being used somewhere.