MyBB Community Forums

Full Version: PHP mail not sending - Please help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Yep, error reported as follows using the original (and renamed) "simplephp.php file:

Parse error: syntax error, unexpected ')' in /www/itrello.com/n/e/e/[b](<EDIT: site name removed due to it no longer being hosted on itrello.com>)/htdocs/Forum/inc/mailhandlers/php.php on line 58
[/b]
I'll try with the fixed file...brb

-------------------------

Back... now, after editing the file to fix the above error, and I get this:

Please make sure IN_MYBB is defined."); } /** * PHP mail handler class. */ class PhpMail extends MailHandler { /** * Additional parameters to pass to PHPs mail() function. * * @var string */ var $additional_parameters = ''; /** * Sends the email. * * @return true/false whether or not the email got sent or not. */ function send() { global $lang, $mybb; // For some reason sendmail/qmail doesn't like rn $this->sendmail = @ini_get('sendmail_path'); if($this->sendmail) { $this->headers = str_replace("rn", "n", $this->headers); $this->message = str_replace("rn", "n", $this->message); $this->delimiter = "n"; } // Some mail providers ignore email's with incorrect return-to path's so try and fix that here $this->sendmail_from = @ini_get('sendmail_from'); if($this->sendmail_from != $mybb->settings['adminemail']) { @ini_set("sendmail_from", $mybb->settings['adminemail']); } // If safe mode is on, don't send the additional parameters as we're not allowed to if(ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on') { $sent = @mail($this->to, $this->subject, $this->message); } else { $sent = @mail($this->to, $this->subject, $this->message); } $function_used = 'mail()'; if(!$sent) { $this->fatal_error("MyBB was unable to send the email using the PHP {$function_used} function."); return false; } return true; } } ?>

Fatal error: Class 'PhpMail' not found in /www/itrello.com/n/e/e/[b](<EDIT: site name removed due to it no longer being hosted on itrello.com>)
/htdocs/Forum/inc/functions.php on line 431[/b]

Pretty much greek to me, though it seems to be 'echoing' the code, but maybe there is something in there that will help narrow down the problem.

Please keep in mind that there is the possibility that the PHP server might not have fully recovered from the "crash" yet or I might have 'broke' the code when editing it. I know the recent MySql server crash my host had probably doesn't help the situation either. Arrgghh.
It looks like you have ?> tag before that which tells PHP that beyond this point is html unless resumed with a <?php

Simply removing the ?> tag should work
(2008-10-17, 11:33 PM)Tom.M Wrote: [ -> ]The only way I can get that to work is if I do to it a local address, such as admin@localhost...

Ok so let me clarify:

- You tried the script at [Wiki: Help:Mail] (Broken link, head over to docs.mybb.com instead) (which uses PHP's mail() function with no additional parameters).
- The result of that script is that PHP mail() only works when you send to a local address such as [email protected].

Am I correct in that interpretation?
(2008-10-20, 07:01 PM)DennisTT Wrote: [ -> ]Ok so let me clarify:

- You tried the script at [Wiki: Help:Mail] (Broken link, head over to docs.mybb.com instead) (which uses PHP's mail() function with no additional parameters).
- The result of that script is that PHP mail() only works when you send to a local address such as [email protected].

Am I correct in that interpretation?

Correct Rolleyes

I'm running an XAMPP service to run a company Intranet built on myBB, and what you said is true. However, even when I connect to our Exhange server (which does SMTP all day) it can't do it. I'm guessing it's probably something to do with how each individual server is setup and the settings chosen.

I've just launched another myBB project on shared hosting and it works with absolutely no problems.
(2008-10-20, 05:00 PM)Ryan Gordon Wrote: [ -> ]It looks like you have ?> tag before that which tells PHP that beyond this point is html unless resumed with a <?php

Simply removing the ?> tag should work

Thanks Ryan, I did as suggested but it still returns the same error.

Please make sure IN_MYBB is defined."); } /** * PHP mail handler class. */ class PhpMail extends MailHandler { /** * Additional parameters to pass to PHPs mail() function. * * @var string */ var $additional_parameters = ''; /** * Sends the email. * * @return true/false whether or not the email got sent or not. */ function send() { global $lang, $mybb; // For some reason sendmail/qmail doesn't like rn $this->sendmail = @ini_get('sendmail_path'); if($this->sendmail) { $this->headers = str_replace("rn", "n", $this->headers); $this->message = str_replace("rn", "n", $this->message); $this->delimiter = "n"; } // Some mail providers ignore email's with incorrect return-to path's so try and fix that here $this->sendmail_from = @ini_get('sendmail_from'); if($this->sendmail_from != $mybb->settings['adminemail']) { @ini_set("sendmail_from", $mybb->settings['adminemail']); } // If safe mode is on, don't send the additional parameters as we're not allowed to if(ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on') { $sent = @mail($this->to, $this->subject, $this->message); } else { $sent = @mail($this->to, $this->subject, $this->message); } $function_used = 'mail()'; if(!$sent) { $this->fatal_error("MyBB was unable to send the email using the PHP {$function_used} function."); return false; } return true; } }

Fatal error: Class 'PhpMail' not found in /www/itrello.com/n/e/e/[b](<EDIT: site name removed due to it no longer being hosted on itrello.com>)
/htdocs/Forum/inc/functions.php on line 431[/b]

I removed the only "?>" that I found at the end of the code, as shown above. However, I do not see a "Class_PhpMail" file in the ../inc/ folder. Should there be a file by that name in there? Would it be in a different folder? Or is a file by that name not needed?

Seems to me, it just can't find what it needs to continue.
(2008-10-21, 11:37 AM)dcaduser Wrote: [ -> ]I removed the only "?>" that I found at the end of the code, as shown above. However, I do not see a "Class_PhpMail" file in the ../inc/ folder. Should there be a file by that name in there? Would it be in a different folder? Or is a file by that name not needed?

Seems to me, it just can't find what it needs to continue.

inc/mailhandlers/php.php
That's the one I had replaced with the code offered in this thread.

After renaming the original and replacing with the code offered in this thread is when these "Class 'PhpMail' not found" errors began. Prior to that, no errors "popped-up" when the 'send' button was clicked. It would just say that the "email was sent successfully" of which actually it wasn't, according to the system email log.

The ../inc/mailhandlers/ folder currently contains the following files:

index.html
php-old.php (the renamed original)
php.php (the edited, renamed from 'simplephp.php', to replace the above)
smtp.php
Please upload your inc/mailhandlers/php.php here
Here is the the one from the site. "PHP.PHP" and what it is supposed to be

I guess the online editor really screwed it up because after noticing a very big difference between the two, I edited the simplephp.php using note pad, uploaded it to the site, renamed it to php.php and tried to send mail. I now get this error:

Parse error: syntax error, unexpected ')' in /www/itrello.com/n/e/e/[b](<EDIT: site name removed due to it no longer being hosted on itrello.com>)/htdocs/Forum/inc/mailhandlers/php.php on line 58[/b]

BTW, in the future I'll edit files ONLY on my local PC instead of using the on-line editor to prevent these unexpected modifications/changes from happening again.

Sorry about the confusion. I did not know the on-line editor would do that to a file.
<br />
Please make sure IN_MYBB is defined.&quot;); }  /**  * PHP mail handler class.  */ class PhpMail extends MailHandler { 	/** 	 * Additional parameters to pass to PHPs mail() function. 	 * 	 * @var string 	*/ 	var $additional_parameters = '';  	/** 	 * Sends the email. 	 * 	 * @return true/false whether or not the email got sent or not. 	 */	 	function send() 	{ 		global $lang, $mybb;  		// For some reason sendmail/qmail doesn't like rn 		$this-&gt;sendmail = @ini_get('sendmail_path'); 		if($this-&gt;sendmail) 		{ 			$this-&gt;headers = str_replace(&quot;rn&quot;, &quot;n&quot;, $this-&gt;headers); 			$this-&gt;message = str_replace(&quot;rn&quot;, &quot;n&quot;, $this-&gt;message); 			$this-&gt;delimiter = &quot;n&quot;; 		} 		 		// Some mail providers ignore email's with incorrect return-to path's so try and fix that here 		$this-&gt;sendmail_from = @ini_get('sendmail_from'); 		if($this-&gt;sendmail_from != $mybb-&gt;settings['adminemail']) 		{ 			@ini_set(&quot;sendmail_from&quot;, $mybb-&gt;settings['adminemail']); 		}  		// If safe mode is on, don't send the additional parameters as we're not allowed to 		if(ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on') 		{ 			$sent = @mail($this-&gt;to, $this-&gt;subject, $this-&gt;message); 		} 		else 		{ 			$sent = @mail($this-&gt;to, $this-&gt;subject, $this-&gt;message); 		} 		$function_used = 'mail()';  		if(!$sent) 		{ 			$this-&gt;fatal_error(&quot;MyBB was unable to send the email using the PHP {$function_used} function.&quot;); 			return false; 		}  		return true; 	} }

Looks like you used a really bad editor because most of that file is missing and corrupted. Upload a fresh file from the MyBB package.
Pages: 1 2 3 4 5 6