0

I have a PHP application with a "send e-mail" function in it. It looks a little like this (hidding personal information):

 //SEND EMAIL
$destination = $destination;
$subject = "Issue - " . {issue_number};
$body = "Mr(s). Issuer <br/><br/>

rest of the message";

$header = 'MIME=Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso8859-1' . "\r\n";
$header .= "To: <$destination" . "\r\n";
$header .= 'From: Issues Central <issuescentral@myisp.com>' . "\r\n";

mail($destination,$subject,$body,$header);

My PHP.ini file (/etc/php5/apache2/php.ini) is set like that:

For Unix only. You may supply arguments as well (default: "sendmail -t -I"). http://php.net/sendmail-path sendmail_path = /usr/sbin/sendmail -t -I

I was looking for the "sendmail" configurations file, and I kind of discovered that it's an alias to "exim4". And I'm kind of lost... Should I configure exim4 files? Which one? And how should I configure it?

Sauced Apples
  • 1,163
  • 2
  • 14
  • 37
Frodo
  • 11
  • 2
  • Depends how you want to send mail: your own full server, or connecting to an existing external smtp server (a smarthost, and exim is a relay), used only to send emails. On Debian use command `dpkg-reconfigure exim4-config` from `exim4-config` package to launch the configuration. You will absolutely need some time through the docs... – Zimmi Sep 29 '16 at 12:50
  • I did used the 'dpkg-reconfigure exim4-config' command, and followed this simple tutorial (https://www.lars-schenk.com/exim4debian-sending-out-emails-over-the-isp-smtp-server-as-a-smarthost/21) Even though, no success. After trying to send an e-mail through the terminal 'mail - "Hello World" frodo@myisp.com' i got the following error: "sendmail process failed with error code 1" – Frodo Sep 29 '16 at 14:53
  • I also had the same error with the command you gave. In the tutorial, there is an example of verbose test command at the end of the article : `mail -v -s "This is a test" info@someotherdomain.com`. And fill some garbage message + Ctrl+D, That could help. Oh once you've updated the config and the `passwd.client` file, you need to run `update-exim4.conf` (yes, it's a command, not a file) and `invoke-rc.d exim4 restart`. (I'm not a mail server specialist, but I installed a exim4 relay on some debian 8 some month ago...). If still no success, check which ports accept mail on the smarthost – Zimmi Sep 29 '16 at 15:34
  • Ok. I also did it using this: mail -v -s "This is a test" info@someotherdomain.com. Talking about the php "mail function" now. It's called in the last line and give the following parameters "mail($destination,$subject,$body,$header);" My "php.ini" file has the following now: sendmail_path = /usr/bin/mail -s, but when i use the application nothing happens. Also, i'm not the application's author... – Frodo Sep 29 '16 at 16:39
  • I'd say leave the sendmail_path commented out, let PHP ues the default value. The default value (`sendmail -t -i`) should be fine. By the way, sendmail should be in `/usr/_S_bin` not `/usr/bin`. – Zimmi Sep 29 '16 at 16:57
  • "By the way, sendmail should be in /usr/_S_bin not /usr/bin" My mistake here, it's set to /usr/Sbin, thanks! – Frodo Sep 29 '16 at 17:29

0 Answers0