Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED EXIM Outgoing IPs Per Account?

Discussion in 'E-mail Discussion' started by Rogerio, Sep 20, 2018.

  1. Rogerio

    Rogerio Well-Known Member

    Joined:
    Sep 26, 2016
    Messages:
    74
    Likes Received:
    13
    Trophy Points:
    8
    Location:
    Sao Paulo, Brazil
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm trying to setup my new server with 2 IPs to send emails using account's IP in SMTP and Exim banner. I read How to Configure the Exim Outgoing IP Address - cPanel Knowledge Base - cPanel Documentation but I cannot accomplish what I need. Please, can you help me?

    Send mail from the account’s IP address is enabled.

    Scenario:
    - server's hostname: first.mydomain.com
    - first IP: 1.1.1.1 PTR first.mydomain.com
    - second IP: 2.2.2.2 PTR second.mydomain.com

    Reason: accounts on 1.1.1.1 will not have IMAP access (basic plan). Accounts on 2.2.2.2 will (pro plan). IMAP ports blocked on iptables (and like --dport 143 -d 2.2.2.2 -j ACCEPT).

    I don't want users know the server is the same. Means, everything in basic plan will refer to 1.1.1.1 and first.mydomain.com, and everything in pro plan 2.2.2.2 and second.mydomain.com. Including SMTP outgoing IP, SMTP HELO and SMTP/POP/IMAP banner (if possible).

    If one user realize that he can "telnet 2.2.2.2 587" and see "first.mydomain.com" as hostname will see that it's the same server. That's not my main problem, but if possible is highly appreciate. My main problem is outgoing SMTP IP.

    I've created 2 DNS zones (on WHM), for each subdomain,
    first.mydomain.com IN A 1.1.1.1
    first.mydomain.com. IN PTR first.mydomain.com.
    ----
    second.mydomain.com IN A 2.2.2.2
    second.mydomain.com. IN PTR second.mydomain.com.

    Exim is always using the correct IP to outgoing connection, but not considering the DNS zones.

    So, from where Exim exaclty get the hostname to use as SMTP HELO?

    Any help is appreciated.
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,890
    Likes Received:
    91
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    You need to enable /etc/mailip in the exim configuration first, so the exim will look for this first before processing the mail.
    Secondly you need to add
    domain: IP address, so domain will from that IP only.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Rogerio

    Rogerio Well-Known Member

    Joined:
    Sep 26, 2016
    Messages:
    74
    Likes Received:
    13
    Trophy Points:
    8
    Location:
    Sao Paulo, Brazil
    cPanel Access Level:
    Root Administrator
    Ok, so, for my case, Send mail from the account’s IP address won't work?

    Using /etc/mailip and /etc/mailhelo works fine.

    And for SMTP banner? Any way to show the rDNS instead of server's hostname?
     
  4. Rogerio

    Rogerio Well-Known Member

    Joined:
    Sep 26, 2016
    Messages:
    74
    Likes Received:
    13
    Trophy Points:
    8
    Location:
    Sao Paulo, Brazil
    cPanel Access Level:
    Root Administrator
    Ah, I found a solution, editing using Exim Advanced Editor:

    1) click "Add additional configuration setting"
    2) insert "smtp_active_hostname"
    3) value "${if exists {/etc/mail_ptr}{${lookup{$interface_address}lsearch{/etc/mail_ptr} {$value}{$primary_hostname}}}{$primary_hostname}}"
    4) edit "smtp_banner"
    5) in the beginning, change "${primary_hostname}" to "${smtp_active_hostname}"

    Then...

    6) create file /etc/mail_ptr like:

    1.1.1.1: first.mydomain.com
    2.2.2.2: second.mydomain.com

    Done. When I "telnet 2.2.2.2 587" I can see:

    220-second.mydomain.com ESMTP Exim 4.91 #1 Thu, 20 Sep 2018 13:34:32 -0300
    220- We do not authorize the use of this system to transport unsolicited,
    220 and/or bulk e-mail.

    POP/IMAP don't have hostname banners. My mistake in the first message.
     
    cPanelMichael likes this.
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,331
    Likes Received:
    2,161
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Rogerio,

    I'm happy to see you were able to solve the issue. Thank you for sharing the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    Rogerio likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice