1 (edited by alakentu 2023-05-26 12:26:20)

Topic: Problem with secondary mail server and IP address

- iRedMail version (check /etc/iredmail-release): 1.6.3
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: debian 11
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

Hi ZhangHuangbin

Time without being here, greetings.

I have a problem with sending mail on one of my mail servers.

I am going to give you some details, I have pfsense installed with a public ip wan, but I also have 4 virtual ips (alias) there, each one active. WAN example with, the virtual ip would be 122, 123, 124, 125, one for each domain I have, ok!

Well then, I already configured an output ip for the first domain and the mail goes out correctly through this ip, which would be the main ip (121), everything is correct. Installed everything fine without problems, configured with nginx and proxy_pass and php-fpm. I can send and receive emails to gmail and hotmail, and internal in the same network.

I go to the second domain, configured in the same way, with the second ip (122), internally emails are sent and received, from 121 to 122 and vice versa, but the big problem is, if I want to send to gmail all the emails come out by the main ip, 121 and not by 122 which is what it is supposed to. Gmail gives me an error message that says:

host gmail-smtp-in.l.google.com[] said:
    550-5.7.25 [] The IP address sending this message does not
    have a 550-5.7.25 PTR record setup, or the corresponding forward DNS entry
    does not 550-5.7.25 point to the sending IP.

Please, can you help me, tell me what could be the problem? The configurations of each mail server are correct, verified and I don't see an error in the logs, only that from the second server emails are sent from the main pfsense ip and not from the alias ip.

Thanks in advance for any help you can give me.

Post's attachments

mail.log 4.93 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.


Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by dave.opc 2023-05-26 17:58:55)

Re: Problem with secondary mail server and IP address

If you have several iredmail servers behind pfsense, than you need to create a rule in Firewall - Rules - LAN
The rule should be like:
Source: IP address of your second iredmail server (for example
then display Advanced options and there select needed Gateway (122 in your case).
Put this rule on the top of all rules. This will route all trafic from this server to 122 gateway.
Of course you should have your PTR records set to correspond to your IPs