PHP script to use mail(x) for sending email using bash
On my linode I want to use Google's smtp servers to send some emails. I have the mailx program installed and this works great from bash.
# echo "This is a test email" | mail -v -s "Test email" someone@somewhere.com
All I need is to be able to provide the body, subject and to address from a PHP script and forward it to bash (anyway to do it inside PHP?) so it can send it away. I just need to send emails.. and can't get sendmail package working.
I am not much of a programmer so any help is very appreciated.. I was thinking of something along the lines.
Any chance something like that can work? Or if the syntax of the "echo" command inside exec is even correct. Thanks for any help/pointers.
2 Replies
First google result:
Now I am looking at using PHPMailer.. still no luck tho.
Edit: Just to clarify I don't have any mail servers (sendmail, postfix, exim etc.) running.. just trying to send mail with php (have pear extension). Is this even doable?