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!

Block some of the recipeints

Discussion in 'E-mail Discussion' started by Azim, May 4, 2018.

  1. Azim

    Azim Well-Known Member

    Joined:
    Oct 16, 2015
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    cPanel Access Level:
    Website Owner
    Hello,

    I am using WHM cpanel for sending email and have done below configuration in the exim configuration for sending email from a different smtp providers in WHM.

    Now, I got one requirement where I have to block couple of users for sending emails to outside of the organization but they can send within server to known domains.

    Please suggest how can I achive this requirement as this would be a great help.

    I have followed below thread for the same.

    Forward certain domain emails to Smart Host

    smarthost_dkim:
    driver = manualroute
    domains = !"+local_domains +smart_hosts"
    condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}"
    ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.0.0.0/32
    headers_add = "${perl{mailtrapheaders}}"
    require_files = "+/var/cpanel/domain_keys/private/${sender_address_domain}"
    transport = remote_smtp_smart_dkim
    route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"


    smarthost_regular:
    driver = manualroute
    domains = !"+local_domains +smart_hosts"
    condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}"
    ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.0.0.0/32
    headers_add = "${perl{mailtrapheaders}}"
    transport = remote_smtp_smart_regular
    route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"

    smart_route:
    driver = manualroute
    domains = !+local_domains
    senders = !*@server.domain.com
    transport = IspSmarthost
    # Exclude null sender messages from relaying via the smarthost
    condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
    route_list = * mail.mailprovider.com
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Azim,

    Could you expand on this some more? For instance, can you provide a specific example of the scenario you are attempting to configure the smart host for?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Azim

    Azim Well-Known Member

    Joined:
    Oct 16, 2015
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    cPanel Access Level:
    Website Owner
    Hello,

    Thanks for your reply and let me explain the requirement in detail,

    1. There is two domains called azim.com and azim2.com, also the cpanel is there also.
    2. I have created ids like user1, user2 and user3.
    3. Azim.com emails delivered from one smtp provider like Google.com
    4. Azim2.com emails delivered from other smtp provider like mailgun.com

    No all users can send emails outside from the organizations like Gmail, yahoo and etc.

    What I need is , user1@azim.com can send email to user2@azim2.com but he can not send email to any gmail.com email id.

    So basically he can send within servers but can not send outside which is unknown domain.

    Please confirm if you have any question.

    Thank you so much for your help.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Azim,

    You might find that creating a custom Exim system filter rule is suitable for this scenario. While we are unable to support the creation of custom filter rules, we document how to do so at:

    How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation

    Additionally, the following threads offer examples you may find useful:

    Blocking all cPanel users from emailing specific domains/email accounts
    Need to filter ALL email

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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