0

I have a phone system that calls a PHP script to send an email after a call. Right now my server is set up to send it with sendmail but I'm switching over to use Mutt to send the emails. the line in my php that sends the email right now is this:

exec(mail($to, $subject, $message, $headers));

Is there something equivalent that I can send the email out through mutt from within the script?

Thanks!

Milksnake12
  • 551
  • 1
  • 9
  • 19
  • I'm not familiar with Mutt, but it appears to be just an email client. Do you have a SMTP server? – simshaun Aug 30 '12 at 21:51
  • I have Mutt configured to send my mail through a yahoo address. Is that what you mean by SMTP server? (sorry, not terribly proficient in this stuff yet >.<) – Milksnake12 Aug 30 '12 at 21:57
  • Yes. Google "yahoo smtp settings". I suggest using a library such as [SwiftMailer](http://swiftmailer.org/) to send the email. It supports sending via a SMTP server and takes care of a lot of nuances for you, regarding email. – simshaun Aug 30 '12 at 21:59
  • Mutt is sending the emails from the command line perfectly, I just need to incorporate this ability into my php script to do what the code in my question is doing with sendmail. – Milksnake12 Aug 30 '12 at 22:02

1 Answers1

1

you can exec command line via shell in you PHP script

shell_exec('mutt -s "Subject" to@mail.com < message.txt');

http://php.net/manual/en/function.shell-exec.php

Paul Yin
  • 1,753
  • 2
  • 13
  • 19