Afternoon all, I recently set up my own local server doing apache, mysql and php individually as oppose to grabbing the available products out there such as WAMP and XAMPP. I've come across an issue when using the mail()
function in php though. That's this:
mail() [function.mail]: "sendmail_from" not set in php.ini
I've tried going into the php.ini file as configuring it but have had no hope. It's come to my understanding that I'm going to need to set up my SMTP? However, I've no idea about how to do this and don't want to go ahead and try without having some knowledge on it first.
Can anyone give me some detailed step by step instructions please on how I can set this up so that my mail()
function in php works great within my local server?
Thanks in advance, Rhys
You are missing From
header applied to your message.
You could do it by specifying 4th parameters $headers
of mail()
function:
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "
" .
'Reply-To: webmaster@example.com';
mail($to, $subject, $message, $headers);
I thing you should download the sendmail utility for sending the mail and it will be very easy to configure.
\usr\lib
on the drive where the unix application is installedc:\bugzilla
, sendmail.exe
and sendmail.ini
need to be copied to c:\usr\lib\sendmail.exe
and c:\usr\lib\sendmail.ini
. configure smtp server
and default domain in sendmail.inihere sendmail.ini
in which you can configure your mail server settings and sending_from, replymail
everything in one file.
I hope it is helpful.
Thanks for the replies everyone. In the end, I figured out I was being silly in the config file for php using wrong syntax. I connected it up with my works SMTP server in the end, so all is good. Thanks for the responses.