I just started using mail-in-a-box and was surprised at how good it is. I was up and running in minutes. I managed to connect to it with thunderbird and emails all working perfectly. I have an email account on there with
I want to use it as my SMTP server for my websites, but have been having issues with emails being rejected. I typically got error messages in my
/var/log/mail.log file like:
Oct 13 12:07:57 ip-172-31-12-116 postfix/smtp: ED13560347: to=<someEmail@gmail.com>, relay=mail-in-a-box.mydomain.co.uk[178.xx.xx.38]:587, delay=0.15, delays=0.01/0.01/0.1/0.02, dsn=5.7.1, status=bounced (host mail-in-a-box.mydomain.co.uk[178.xx.xx.38] said: 553 5.7.1 <firstname.lastname@example.org>: Sender address rejected: not owned by user email@example.com (in reply to RCPT TO command))
It looks like sendmail would always send using the local user that was sending the email, rather than the one that was programmed in. For example, the forum is running as the www-data user so the emails were from firstname.lastname@example.org instead of the one set in the forum (email@example.com). Likewise, if I manually tried to run the sendmail command, it would appear in the error logs as coming from the
admin user I had SSHd into the server with.
I had to get around this by editing the apache php.ini file and changing the
sendmail_path parameter from:
sendmail_path = /usr/sbin/sendmail -t -i ``` ...to ``` sendmail_path = /usr/sbin/sendmail -t -i -f "firstname.lastname@example.org" ``` I swear I have had this work with other SMTP providers where the "from" mail is used in the sendmail usage by the PHP website and that is what is sent from, rather than the www-data user (hopefully that makes sense). For now this works, but I would like to be able to rely on the "from" input field in my website, and not have to remember than I hardcoded it into the php.ini file. Is there some workaround to this other than possibly setting up a email@example.com?