Php5 mail () function sendmail error

I try to use the php mail () function, but I get an error. I installed sendmail through sudo apt-get install sendmail, edited the file /etc/php5/cli/php.ini, adding the following text to these lines:

 sendmail_path = /usr/sbin/sendmail -t
 sendmail_from = uslonsweb003.ALU@no-reply.com

Then I restarted my web server and used this command for a test:

 :~$ php -r "mail('sadmicrowave@gmail.com', 'test subject', 'test body message');"

but I get the following error: EVERYTIME !!!:

 sh: -t: not found

This is strange because I tried sendmail_path with -t and without -t, but I still get the same error. What am I doing wrong?

UPDATE! this is what my phpinfo () shows: (I added -t back, but the command does not work with or without it).

enter image description here

Other UPDATE -

sendmail_path sendmail_from, , , mail() , php , , , ( !!). , sendmail mail()...

+3
4

, SwiftMailer, , . :

require_once('/var/www/global/swiftmailer/lib/swift_required.php');
$transport = Swift_SmtpTransport::newInstance( 'mailout.usa.mycompany.com', 25 );
$mailer = Swift_Mailer::newInstance( $transport );
$message = Swift_Message::newInstance( 'Suggestion Status Update' )
    ->setFrom( array( 'uslonsweb003@no-reply.com' => 'SuggestionBox' ) )
    ->setTo( array( $pEmail => $username ) )
    ->setBody( $body, 'text/html' )
    ;
$result = $mailer->send( $message );
0

, sendmail_path = /usr/sbin/sendmail -t -i. -, . , phpinfo() sendmail.

+1

, , , -t , "To:", "CC:" "BCC:"

, :

php -r "mail('sadmicrowave@gmail.com', 'test subject', 'test body message', 'To: Receiver <receiver@email.com>');"
+1

phpinfo(), , :

  • .ini

, .

0

All Articles