I needed to let PHP send mails from my webserver to my web app users. So I installed qmail on my Debian server:
sudo apt-get install qmail
I also updated files in /etc/qmail specifing my domain name, and then I run sudo qmailctl reload and sudo qmailctl restart:
/etc/qmail/defaultdomain # Contains 'mydomain.com'
/etc/qmail/defaulthost # Contains 'mydomain.com'
/etc/qmail/me # Contains '
mail.mydomain.com'
/etc/qmail/rcpthosts # Contains 'mydomain.com'
/etc/qmail/locals # Contains 'mydomain.com'
Emails are sent without any problem from my PHP script to any email address, using the standard
mail PHP library.
Now the problem is that if I send
mail from my PHP using
[email protected] as sender address, I want that customer can reply to that address! And possibly, I want all mails sent to this address should be forwarded to my personal Gmail address.
At the moment qmail seems to not accept any
incoming mail because of "invalid mailbox name". Here is a complete SMTP session I established with my server:
me@MYPC:~$ nc mydomain.com 25
220 ip-XX-XX-XXX-XXX.xxx.xxx.xxx ESMTP
HELO
[email protected]
250 ip-XX-XX-XXX-XXX.xxx.xxx.xxx
MAIL FROM:<
[email protected]>
250 ok
RCPT TO:<
[email protected]>
250 ok
DATA
554 sorry, invalid mailbox name(s). (#5.1.1)
QUIT
I'm sure I missing something related to mailbox or alias creation, in fact I did nothing to define mailbox
[email protected] anywhere. But I tried to search something on the net and on the numerous qmail man pages, bot I found nothing.