Linux – how to set exim4 sender_helo_name on debian

debianeximlinux

am using exim4 mail server on my vps running debian 8.9 , problem is i can get email but cant send mails , so when i send mail from roundcube to gmail i get error

SMTP Error (550): Failed to set sender (Access denied – Invalid HELO
name (See RFC2821 4.1.3)).

so i check exim4 template and debug it and found that $sender_helo_name is set to my server ip address. so i was wondering how to set $sender_helo_name value to my site domain

update exim main log :

2017-09-28 09:33:56 H=localhost (198.50.220.183) [127.0.0.1] rejected MAIL <contactus@useotools.com>: Access denied - Invalid HELO name ( 198.50.220.183) (See RFC2821 4.1.3)
2017-09-28 09:36:23 no host name found for IP address 123.56.151.114
2017-09-28 09:36:24 no host name found for IP address 123.56.151.114
2017-09-28 09:39:01 1dxQbF-0003dy-6j <= root@useotools.com U=root P=local S=1044
2017-09-28 09:39:01 1dxQbF-0003dy-6j => root <root@useotools.com> R=localuser T=local_delivery
2017-09-28 09:39:01 1dxQbF-0003dy-6j Completed
2017-09-28 09:43:17 no IP address found for host 207-101-169-181.fibertel.com.ar (during SMTP connection from [181.169.101.207])
2017-09-28 09:43:18 no IP address found for host 207-101-169-181.fibertel.com.ar (during SMTP connection from [181.169.101.207])
2017-09-28 09:46:36 no IP address found for host ip-187.94.111-100.globalwave.com.br (during SMTP connection from [187.94.111.100])
2017-09-28 09:46:37 no IP address found for host ip-187.94.111-100.globalwave.com.br (during SMTP connection from [187.94.111.100])
2017-09-28 09:53:15 no host name found for IP address 41.191.224.5
2017-09-28 09:53:16 no host name found for IP address 41.191.224.5
2017-09-28 09:54:23 exim 4.84_2 daemon started: pid=15145, -q30m, listening for SMTP on port 25 (IPv4) port 587 (IPv4) port 2525 (IPv4) and for SMTPS on port 465 (IPv4)

Best Answer

Define the macro MAIN_HARDCODE_PRIMARY_HOSTNAME and set it to the desired name. Typically this would be something like mail.example.com or smtp.example.com. If you are using split configuration, use a file in /etc/exim4/conf.d/main. Otherwise, use /etc/exim4/exim4.conf.localmacros.

The 550 error is being sent by the receiving server to indicate your HELO name is invalid. It should be set to the same value as the PTR record for your servers IP address. To set the PTR record you need a static IP address and the co-operation of your provider. You also need a corresponding A record for the name of your mail server. This will enable rDNS validation of the name. Your MX record should point to this name.

Also look at setting up an SPF record for your mail server and your domain.

Using your VPS provider's relay server may be a simpler solution. Use a smarthost configuration with local mail. Configure the relay server as the smarthost server. Modify your SPF record to indicate that the relay server can send mail for your domain.