I am trying to send email to my machine from my puphpet virtual machine and I can't seem to have php send email. If I run
vagrant up sudo apt-get update sudo apt-get install mailutils
I can then send email via the vagrant ssh terminal, which works great but I would like to send it to my machine via php's mail function.
mail -s "test" [email protected] crtl+d ctrl+d
I am running this script which does not seem to work.
$ok = mail('[email protected]', 'test', 'test'); var_dump($ok);
I have tried installing postfix email and also sendmail. Any ideas as to why php will not send any email...
update
I added this line to my config.yaml file in the puphpet folder. I also changed mailcatcher to 0. I then ran vagrant provision again. It works great now, no delay at all, just make sure sendmail/postfix is installed. sudo apt-get install sendmail or postfix
mailcatcher:
install: '0'
farther down...
ini:
sendmail_path: '/usr/sbin/sendmail -t -i'
Have you checked your web server's log file? Your PHP script is probably looking for the mail command on the wrong place on your system. Maybe the symbolic link for mail is not on the right place or missing? You mention you did postfix and sendmail.
On my ubuntu system I have postfix and the mail symbolic link is at /usr/bin/mail.
Try also from command line to run "php -i |grep mail". On mine I see:
mail.add_x_header => On => On
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
mailparse
mailparse support => enabled
mailparse.def_charset => us-ascii => us-ascii
Path to sendmail => /usr/sbin/sendmail -t -i
MAIL => /var/mail/root
_SERVER["MAIL"] => /var/mail/root
Check out the "sendmail path" (even on postfix it shows like that) and the "path to sendmail". Make sure these are set correctly according to what you have on your system.