Jump to content

Call to undefined function: mail()


Recommended Posts

Hi all

I have recently moved a php application my company uses to a different server (it worked fine on the previous one)

I have configured the new linux machine from scratch..

Eventually getting PostgreSQL to work, the only problem i now have is the following

Fatal error: Call to undefined function: mail() in /usr/local/apache/htdocs/classes/***.inc on line 1446

 

Seems to me like for what ever reason the mail/sendmail function has not come installed with PHP...

Anyone have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/243818-call-to-undefined-function-mail/
Share on other sites

// EMAILING FUNCTION

function eMail($recipient, $subject, $message)
				{	
				$headers = "MIME-Version: 1.0\r\n";
				$headers .= "From: NAME <address>\r\n";
				$headers .= "Reply-To: NAME <address>\r\n";
				$headers .= "X-Priority: 1\r\n";
				$headers .= "X-MSMail-Priority: High\r\n";
				$headers .= "X-Mailer: PHP / " . phpversion() . "\r\n";
				$From = "address"; 
			 	//echo "$recipient<br> $subject<br> $message<br>$headers"; exit;
****			if (mail($recipient, $subject, $message, $headers))	{ 
				  $a = 1;
				  /* mail('address', $subject, $message, $headers);
				   mail('address', $subject, $message, $headers);
				   mail('address', $subject, $message, $headers);
				   mail('address', $subject, $message, $headers);
				   */
					}
                	}	
/*

 

 

The line with **** is 1446.

 

What i cant understand is, the code works fine on the current live machine.

Cheers

 

Does the output from a phpinfo(); statement contain any reference to 'mail' (search on the page using your browser's find function.)

 

What exact problem did you originally have when trying to build/install php5?

The only mentions of mail are

sendmail_from no value no value

sendmail_path /usr/sbin/sendmail -t /usr/sbin/sendmail -t

 

I dont think the code worked under php5, although im not sure if i coppied the php.ini off the old server ( just tried this on php4 and it doesnt work either)

Im thinking if i cant get this to work, either installing php5, or i should be able to change the code from mail() to PEAR mail shouldnt i?

If you are getting the same error message (undefined function: mail()) on different systems, it is likely that your source file is corrupted and either has some non-printing characters or some non ASCII encoded characters as part of the 'mail' name.

 

I would delete and retype the 'mail' name along with a few characters before and after that in the source code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.