I just bought a new "public cloud" to put my new website on it.
This public cloud is in "advanced zone", which means that every instance I deploy is in a NAT network with private IP (10.1.1.x), and there is a firewall in front of the global network to control IN and OUT ports.
I have deployed two instances with Debian 8, one for webserver & the other one for the database. I have my own domain name (let's say "mydomain.com"), and I want my website to be able to send email using this domain name (FROM would be "no-reply@mydomain.com") and I would like to receive emails sent by users of the website (TO contact@mydomain.com) using a Thunderbird or Outlook for example.
Exim4 was already installed on the webserver (installed by default in Debian 8), I used dpkg-reconfigure exim4-config
to reconfigure it. Here is the content of my different files.
/etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='internet'
dc_other_hostnames='contact.mydomain.com'
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
/etc/hosts :
ROUTER_IP mydomain.com contact
/etc/hostname :
contact
/etc/email-addresses :
contact@mydomain.com
When I type hostname
: contact
When I type hostname -d
: com
When I type hostname -f
: mydomain.com
In my DNS I created a zone with SPF type to avoid spam. Here it is :
TTL = 600 / Target = "v=spf1 a mx ptr ~all"
I tried to send an email using this command :
echo "This is a test." | mail -s Testing myownaddress@gmail.com
When I'm sending an email to gmail, I receive an email from root (root@mydomain.com)
and not contact@mydomain.com
When I'm sending an email to my own personnal address, I have an error in exim4 mainlog /var/log/exim4/mainlog
:
SMTP error from remote mail server after RCPT TO:<johnny@myserver.com>: host mail.myserver.com [37.xx.xx.Xx]: 504 5.5.2 <contact>: Helo command rejected: need fully-qualified hostname
I don't understand what I'm doing wrong. Do you have any idea on this please ?
Thanks in advance !
Regards,
Julien Q.
I decided to go with Postfix and use my main server as a SMTP relay.