outgoing mails copy

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
I have a strange requirement come to me from few customers who are moving from plesk to cpanel. It seems in plesk there is a feature to forward a copy of all outgoing mails send through SMTP/webmail to an email id which can be defined by the user itself. This allows administrators in companies to check what mail traffic is being using the company domain.

I understand using exim filters something like this can be achieved, is there someone who has done something like this ? I tried searching in the forums however none of the posts seemed to have any satisfying replies/ solution.

Any help would be appreciated.
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
Aric1 said:
MailScanner can do that. Add MailWatch and the mail doesn't need to be forwarded, you can check it on-line via a browser. Chirpy has the MailScanner frontend for CPANEL that includes a WHM backend that can integrate MailWatch.
Thx for the reply however i am looking at a solution which doesn't include mailscanner.
 

webignition

Well-Known Member
Jan 22, 2005
1,876
0
166
A bit of a vague suggestion . . .

If Plesk uses Exim, one would hope that the setting chosen through Plesk's interface changes something in the Exim configuration. If so, you could do the same, which would of course require a good look through the Exim documentation.
 

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,531
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
You might be able to use something like the follow I found.

In exim.conf in system_filter.
Code:
if
 $sender_host_authenticated is not "" and $authenticated_id is not ""
then
 unseen deliver ${quote:$authenticated_id}[email protected]
endif
That said, chirpy would be a good one to ask.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
31
473
Go on, have a guess
I would imagine that it would indeed be the system filter that you would have to use some kind of coding , the main trick is ensuring that it is outgoing email that you are parsing and not incoming email. I would think that's what the condition statements are doing.

Have a play with what dgbaker posted, culd well work ;)
 

Ali

Well-Known Member
Jul 12, 2003
52
0
156
Suprising as it is we have received similar requests too, customers wishing to keep a copy of Incoming and Outgoing emails exchanged via their business domains by banking/filing the mails on a specific email account.
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
anton_latvia said:
anand, did you manage to make it work? For some interesting reason I also have this request from one of our dedicated server owners.
Due to some other work in hand, i had to leave this problem in as it is condition. Do post if you guys find something on this. As dgbaker and chirpy said, system filters would be the solution for the same.
 

Zaf

Well-Known Member
Aug 22, 2005
117
0
166
AQHost said:
Had a request for this too, and did it successfully with a filter in /etc/antivirus.exim

Code:
if $sender_address is [email protected]
then
 unseen deliver [email protected]
endif
That will forward a copy of any mail sent by [email protected] to the [email protected] mailbox. Copying the incoming mail is done easily with a standard forwarder.
I believe that would only work for one email id only...could we do it for all mail ids for a domain or all domains even?
 

elitewebninja

Active Member
Jan 2, 2004
43
0
156
Atlanta Ga!
Here you go... this will get every email that comes in OR goes out that contains the domain name in the header.

if $message_headers matches "domain.com"
then
unseen deliver [email protected]
endif

I tested it and it works for me.

If you want to do multiple domains, just change the if line from:
if $message_headers matches "domain.com"
to
if $message_headers matches "domain.com|domain2.com|domain3.com"

etc
 
Last edited:

tsook

Well-Known Member
Mar 21, 2003
55
0
156
elitewebninja said:
Here you go... this will get every email that comes in OR goes out that contains the domain name in the header.

if $message_headers matches "domain.com"
then
unseen deliver [email protected]
endif

I tested it and it works for me.

If you want to do multiple domains, just change the if line from:
if $message_headers matches "domain.com"
to
if $message_headers matches "domain.com|domain2.com|domain3.com"

etc

OK! But if i would like to add something to subjest eg. [OUTGOING-CATCH], or change subject with that, is that possible?
 

erick_paper

Well-Known Member
Apr 19, 2005
245
0
166
AQHost said:
Had a request for this too, and did it successfully with a filter in /etc/antivirus.exim

Code:
if $sender_address is [email protected]
then
 unseen deliver [email protected]
endif
That will forward a copy of any mail sent by [email protected] to the mo[email protected] mailbox. Copying the incoming mail is done easily with a standard forwarder.
Thank you. This works, but only if the email is sent FROM the user. I am using my domain to actually send emails, but the FROM is different--the FROM is my local ISP email address. I am using Outlook to send my email. Any idea what I should use instead of 'sender_address' to check the authenticated user?

Just to clarify, here is an example.

My hosting domain: GREAT.COM
My hosting domain email ID through cpanel: [email protected]
My ISP email address: [email protected]

When my friends receive email, they see the 'FROM' as [email protected], but I am actually sending email through my own hosting domain GREAT.COM, so my smtp server is SMTP.GREAT.COM.

Appreciate any ideas!