Failed sending email ::PHP:: - Line 234 - Update?

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
otocyon
Registered User
Posts: 10
Joined: Tue Jul 31, 2007 12:27 am

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by otocyon »

Where exactly did you put this?
gundamseedes
Registered User
Posts: 25
Joined: Sat Feb 03, 2007 5:30 am

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by gundamseedes »

and if u dont mind. maybe you could upload your own file
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by espicom »

The code to be changed is in emailer.php, and the fix is intended to work with certain hosts... it won't fix the problem in the general sense, but it works with Godaddy and some others. You will find a line similar to what is in the CODE window, but does not have the part about "-f [email protected]" in it. You can search the file for "$result = mail($to" to find it.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

I have been having the same problem and SMTP also causes an error. With Sendmail, although the person who is registering gets the same error message, the emails are being sent.

I tried the last mod of adding the last parameter, but it made no difference.

I'll try the previous one of setting the 'from' address at the top of the file.
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

The code that was given was:

Code: Select all

ini_set('sendmail_from','[email protected]');
but I assume the sendmail_from variable should be just 'from', because sendmail_from does not exist. This would make it:

Code: Select all

ini_set('from','[email protected]');
However, I'm not certain where it should go. The start of the file is:

Code: Select all

class emailer
{
	var $msg, $subject, $extra_headers;
	var $addresses, $reply_to, $from;
	var $use_smtp;
Should the ini_set go before or after the vars - presumably it should go after?
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by espicom »

ini_set is to make some changes to how PHP is configured, so sendmail_from is NOT one of the variables inside phpBB.

The line should be after the var statements. Actually, a good place to put it would be just before:

Code: Select all

		// We now try and pull a subject from the email body ... if it exists,
		// do this here because the subject may contain a variable
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

espicom

Thanks for the explanation. However, it didn't resolve the problem. I still get:
General Error

Failed sending email :: PHP ::

DEBUG MODE

Line : 246
File : emailer.php
This is still because of an error with:

Code: Select all

$result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
I'm tempted to comment out the message_die line at least for now. I take your point that it is simply hiding the issue, but at least it'll look better to new users and stop them trying to register multiple times because they think something has gone wrong.

Any other suggestions?
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

Would it be worthwhile knowing what value the @mail function returns, or is it likely just to be true or false?
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by espicom »

The @ in front of mail() suppresses logging an error, because it isn't supposed to generate an error. What would REALLY help is your host fixing the underlying problem... the ini_set() call would ONLY affect users of the same host as the original poster, or someone with the same screwball settings.

You need to have the host involved to get the REAL problem. Right now, you know an error occurred; however, you do not know whether it was because there was no configured FROM address (only affects users on Windows-based servers, by the way, and the fix you're trying won't do any good on any other server type), or if it is because the host disabled the mail() function completely.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

espicom

Thanks for explaining about the code. My host is on Linux, so the 'from' fix won't work. As I said before, the email does get sent, so the mail function does work - it is just a mystery why the mail command causes an error.

I tried my hosts tech support before posting here. They first of all suggested using SMTP instead of sendmail, but this caused a similar error (I can't remember the details), so I went back to sendmail. I did get the run around a bit, but they at least did try. However, they obviously searched this forum and came up with something similar and suggested it was a phpBB problem, rather than theirs. I can't remember if it was this actual thread they pointed me to, but I saw that other people were having the same problem.

I'm now in the position that I have commented out the message_die statement so users are no longer confused by the error, but no where nearer knowing what the real problem is!

Is there anyway to work out if it is a host problem? Is there some simple code I can run that will show what the error is and that I can pass to my host to show them that it is their problem? What's the simplest code I need to send an email and trap any errors?
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by espicom »

Well, it is strange that it would give an error AND send the mail out, so, yes, commenting out the message_die call would probably be your best solution at this point. When you do NOT use SMTP on Linux, it calls the sendmail script on the host computer, which normally will either work or return an error... not both.

Using SMTP also allows you to properly set the return address. Knowing what error message the SMTP gave you would be helpful...
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

OK, changed over to SMTP, registered and got the following error:
General Error

Ran into problems sending Mail. Response: 503 valid RCPT command must precede DATA

DEBUG MODE

Line : 185
File : smtp.php
Line 185 of smtp.php is:

Code: Select all

server_parse($socket, "354", __LINE__);
However, I did get the welcome email. (Is there any possibility that the email the new user is getting is NOT the one the error is occurring on? However, the only other email that gets sent is the one to admin saying there is a new user who has registered so they can be activated and this is also being sent OK.)

Does this help?
zeno
Registered User
Posts: 36
Joined: Fri Aug 10, 2007 2:22 pm

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by zeno »

Something else I tried (after changing back to sendmail from SMTP) was to enable displaying my email address and then sending myself an email by clicking on the email link in my profile. There was no error and I received the email correctly, so there only seems to be an error when someone registers. This is obviously different, and shows that sendmail does work OK sometimes, but does it tell you anything else?
synth19
Registered User
Posts: 60
Joined: Wed Apr 21, 2004 12:24 am

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by synth19 »

Do you actually use the word "forum" in the "[email protected]" thanks
Paul Claessen
Registered User
Posts: 13
Joined: Wed May 18, 2005 8:38 pm
Location: Palm Bay, Florida
Contact:

Re: Failed sending email ::PHP:: - Line 234 - Update?

Post by Paul Claessen »

For the "Line: 234" error ... see my take on it: http://claessen.com/phpbb_emailer_php.php
Locked

Return to “2.0.x Support Forum”