apache - send email using php with AWS EC2 -


i use aws ec2 server (ubuntu instance) , want send email through php code

i installed sendmail , modify .mc file blow


feature(`no_default_msa')dnl  dnl daemon_options(`family=inet6, name=mta-v6, port=smtp, addr=::1')dnl  daemon_options(`family=inet, name=mta-v4, port=smtp, addr=127.0.0.1')dnl  dnl daemon_options(`family=inet6, name=msp-v6, port=submission, m=ea, addr=::1')dnl  daemon_options(`family=inet, name=msp-v4, port=submission, m=ea, addr=127.0.0.1')dnl  

i removed addr , restart sendmail service

but, cannot send email.

i tested sendmail on console (sendmail to@mail.com from@mail.com)

and php file php sendmailtest.php.

both of them work!

but, still doesn't work when tried browser. ( http://test.com/sendmail.php )

here apache log

sh: 1: sendmail: not found  [thu apr 25 03:40:53 2013] [error] [client xxx.xxx.xxx.xxx] xxx@gmail.com  [thu apr 25 03:40:54 2013] [error] [client xxx.xxx.xxx.xxx] file not exist: /var/www/favicon.ico  

update

here test code send email

 $mailto="xxxxxxxx@gmail.com";  $subject="mail test";  $content="test";  $result=mail($mailto, $subject, $content);  if($result){     echo "mail success";  }else  {     error_log($mailto, 0);       echo "mail fail";  } 

thanks in advance,


solved problem.

i should input /usr/sbin/sendmail

i don't know why location doesn't work there exists sendmail.

use absolute path sendmail, when running script path not setup.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -