email - php Mail() function doesn't work -


i'm working on php script has send emails. mail() function doesn't work. know have configure somehow php.ini , may else don't know , how. installed sendmail, way. ideas? lot. code.

error_reporting(e_all);   $to  = 'name@gmail.com';  $subject = 'subject';  $message = 'text';  $headers  = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=windows-1251' . "\r\n"; $headers .= 'to: user <user@example.com>' . "\r\n"; $headers .= 'from: server <server@example.com>' . "\r\n";  mail($to, $subject, $message, $headers); 

in php.ini put sendmail_path ="/usr/sbin/sendmail"

ps. use ubuntu

guys, in mail.log file got

apr 29 16:12:05 it02 sendmail[7660]: unqualified host name (it02) unknown; sleeping    retry  apr 29 16:13:05 it02 sendmail[7660]: unable qualify own domain name (it02) -- using short name  apr 29 16:13:05 it02 sendmail[7660]: p3ted551007660: from=www-data, size=210, class=0, nrcpts=0, msgid=<201104291413.p3ted551007660@it02>, bodytype=8bitmime, relay=www-data@localhost  

does know means?

the first step figure out sendmail installed. once know path, go php.ini. looking sendmail_path setting. set appropriately.

if path set correctly, result proper call mail() should return true. (note return value lets know if message passed on sendmail [or smtp in case of windows]. not guarantee e-mail went out, or sendmail configured correctly.) if returning true , still aren't getting e-mail, check sendmail configuration.


Comments