The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Want to save all outgoing email to read later...

Discussion in 'E-mail Discussions' started by RandyL712, Feb 18, 2009.

  1. RandyL712

    RandyL712 Well-Known Member

    Joined:
    Jul 31, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    I have a customer who wants to monitor all outgoing email (to see what his employees are sending their customers). What's the easiest way to set this up? If it's possible, probably invisibly forwarding all outgoing email to his private email box would work.
     
  2. JPC-Martin

    JPC-Martin Active Member
    PartnerNOC

    Joined:
    May 31, 2008
    Messages:
    37
    Likes Received:
    1
    Trophy Points:
    8
    Some webmail and mail clients like Horde provide option to cc every outgoing mail automatically.

    There is another way to check outgoing emails from some specific email/domain that is check email logs from server and read their body but this is tough job and you must have root access for this.

    Also there is many software availble on the internet , do this job efficiently. i.e Spector CNE , you can also google on such tools
     
  3. RandyL712

    RandyL712 Well-Known Member

    Joined:
    Jul 31, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    I may not have explained the need well.

    We host a domain - DOMAIN.com - and the owner of that company wants to be able to read every outoging email his employees send, so that he can monitor the level of customer service they're providing.

    And of course, we want to do it as easily as possible. If it's possibly to secretly forward every outgoing email into a private email box that he has access to, or something like that, that'd be perfect. We're open to other suggestions on how to accomplish this.

    Thanks!
     
  4. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Login to WHM as root:

    Main >> Service Configuration >> Exim Configuration Editor

    Check the name & location of "System Filter File", mine is at
    /usr/local/cpanel/base/eximacl/antivirusandspam.exim

    Now edit this file in your favorite editor and insert this code:

    For collecting outgoing mails only

    Code:
    ### START OF OUTGOING MAIL FORWARDING ###
    
    if first_delivery
       and ("$h_from:" contains "user@domain.com")
    then
       unseen deliver "monitor@domain.com"
    endif 
    
    ### END OF OUTGOING MAIL FORWARDING ###
    For collecting both outgoing and incoming mails:

    Code:
    ### START OF OUTGOING + INCOMING MAIL FORWARDING ###
    
    if first_delivery
       and ("$h_to:, $h_cc:" contains "user@domain.com")
       or ("$h_from:" contains "user@domain.com")
    then
       unseen deliver "monitor@domain.com"
    endif
    
    ### END OF OUTGOING + INCOMING MAIL FORWARDING ###
    Above method will silently/invisibly forward mails to the mail ID monitor@domain.com (change it to actual mail ID where you want all the mails to be delivered, this could be an internal or external mail ID)

    Chane user@domain.com to actual mail ID that is to be monitored.

    You have to make one entry per user between the comments.

    Like I have

    Code:
    ### START OF OUTGOING + INCOMING MAIL FORWARDING Company-1###
    Entry - 1
    
    Entry - 2
    
    Entry - 3
    ### END OF OUTGOING + INCOMING MAIL FORWARDING Company-1 ###
    
    ### START OF OUTGOING + INCOMING MAIL FORWARDING Company-2###
    Entry - 1
    
    Entry - 2
    
    Entry - 3
    ### END OF OUTGOING + INCOMING MAIL FORWARDING Company-2 ###
    Important: If the system filter mentioned in WHM is "/etc/cpanel_exim_system_filter_custom" change it to something like "/etc/cpanel_exim_system_filter_custom", otherwise cPanel update will overwrite it.

    Don't forget to restart Exim.
     
    #4 Vinayak, Feb 21, 2009
    Last edited: Feb 21, 2009
  5. RandyL712

    RandyL712 Well-Known Member

    Joined:
    Jul 31, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Where in the file should that code be placed? I put it at the bottom and it didn't work.

    Also - can I simply put a domain name to catch all emails? such as:
    Code:
    ### START OF OUTGOING + INCOMING MAIL FORWARDING ###
    
    if first_delivery
       and ("$h_to:, $h_cc:" contains "@domain.com")
       or ("$h_from:" contains "@domain.com")
    then
       unseen deliver "monitor@domain.com"
    endif
    
    ### END OF OUTGOING + INCOMING MAIL FORWARDING ###
    I want to catch ALL email to/from this domain. (From being most important)

    THANK YOU!
     
  6. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    You must already be having an entry

    Code:
    if not first_delivery
    then
      finish
    endif
    
    So put the filter code below that. Save the file, and restart exim

    HTML:
    service exim restart
    Yes you can use "@domain.com"
     
  7. RandyL712

    RandyL712 Well-Known Member

    Joined:
    Jul 31, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Working great, thanks so much.
     
  8. sphost

    sphost Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6

    can you tell me how to do it either through WHM or ssh?

    thanks
     
  9. RandyL712

    RandyL712 Well-Known Member

    Joined:
    Jul 31, 2002
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    He already told you how to do it during the shell session:

    In WHM there are restart links at the bottom of the left navigation bar.
     
  10. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    this script is only a part of particular domain e.g domain.com but what about other domains which are hosted & if they want same

    in my server there are more than 150 domains are hosted e.g mydomain.com , mydomain.org , testdomain.com , testing.com

    In mydomain.com there 5 email accounts
    test1@mydomain.com
    test2@mydomain.com
    test3@mydomain.com
    test4@mydomain.com
    test5@mydomain.com

    all email which are sent from those ids must be copy to monitor@mydomain.com

    same thing for testdomain.com
    test1@testdomain.com
    test2@testdomain.com
    test3@testdomain.com
    test4@testdomain.com
    test5@testdomain.com

    all email which are sent from those ids must be copy to Owner@testmydomain.com

    same thing for testing.com , mydomain.org
     
  11. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Nilesh, you need to repeat those steps for each domain that you want to monitor.
     
  12. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    but there are more than 200 domains hosted on our server

    how can is this problem to do this ?
     
  13. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Does all the 200 domain owners need this to be done?
     
  14. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16

    yes they want
     
  15. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Well then I am afraid, you have to repeat the steps for all the domains.
     
  16. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    can you make for below 2 domains for example

    Code:
    mydomain.com there 5 email accounts
    test1@mydomain.com
    test2@mydomain.com
    test3@mydomain.com
    test4@mydomain.com
    test5@mydomain.com
    
    all email which are sent from those ids must be copy to monitor@mydomain.com
    
    test1@testdomain.com
    test2@testdomain.com
    test3@testdomain.com
    test4@testdomain.com
    test5@testdomain.com
    
    forwarded copy to owner@testdomain.com
    
     
  17. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    See the examples I have given above, if you want to forward all the emails on a domain you don't have to make entry for each and every email, but if you just want to monitor an specific email ID or not all email accounts on that domain then you have to make entry for all those email IDs.

    The same is to be repeated for the second domain.

    Take hint from http://forums.cpanel.net/481941-post4.html
     
  18. furquan

    furquan Well-Known Member

    Joined:
    Jul 27, 2002
    Messages:
    425
    Likes Received:
    0
    Trophy Points:
    16
    very helpful :)

    Very Very helpful...

    Vinsar, do you have any more tips and tricks to share ;) for the novice like us :)

    Happy New Year !!!!!!!!!!!
     
  19. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
    Well to be frank I just search for answers, discuss with others when I need something. And post the answer if I know it.

    So when you need something just post it on the forums, 99% time you will get the solution.

    Happy New Year.
     
  20. l00ph0le

    l00ph0le Member

    Joined:
    Aug 16, 2007
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Looking to do this, but having trouble looking for the necessary files with 11.25 and just cant seem to do it...Any advice would be nice.
     
Loading...

Share This Page