I finally found a way in Qmail to forward carbon copy of all outgoing messages to an email address of your choice instead of writing it on a log file of a server. ![]()
Basically, you would need the source file extra.h of your Qmail installation. The said file would contain this lines:
#ifndef EXTRA_H
#define EXTRA_H
#define QUEUE_EXTRA “”
#define QUEUE_EXTRALEN 0
#endif
If for example you want to forward carbon copies of outgoing messages to [email protected], you just have to change the values of QUEUE_EXTRA and QUEUE_EXTRALEN like this:
#define QUEUE_EXTRA "[email protected]\0"
#define QUEUE_EXTRALEN 23
QUEUE_EXTRA would contain the email addres where you want the outgoing messages to be forwarded to. You just have to enclose the email address between a T and a \0.
On the other hand QUEUE_EXTRALEN would contain the number of characters of your email address plus 2 ( T is considered 1 additional character and \0 is also considered as 1). In this case, since [email protected] contains 21 characters, adding 2 would make it 23 (basic math, ei
) .
After making the changes you have to re-compile the Qmail source code. So if your Qmail source files are located on /usr/local/src/qmail-1.03 you would do something like this:
1. Stop Qmail first
If you’re using daemontools:
svc -d /service/qmail
If you’re using qmailctl:
qmailctl stop
2. Go to your Qmail source directory
cd /usr/local/src/qmail-1.03
3. Recompile the codes
make setup check
4. Start qmail again
If you’re using daemontools:
svc -u /service/qmail
If you’re using qmailctl
qmailctl start
That’s it! Simple but useful for those mail administrators who would like to monitor the mails going out of their servers. Just make sure that you respect the privacy of your users and just try to read those mails that are suspicious or you think are abusive. ![]()
Popularity: 39% [?]
March 5th, 2008 at 6:53 am
fduMzq hi nice site man thx http://peace.com
May 29th, 2008 at 3:29 pm
much useful info; thanks a lot; rating: 5 stars (out of 5)
September 16th, 2008 at 1:14 am
cup
September 25th, 2008 at 8:22 pm
hi,
thanks for the info.
it’s a pretty useful information.
(5 / 5)
i’ve tried it.
i’ve implemented this technique in our qmail server.
it’s working fine for the domain. all the incoming and outgoing mails are forwarded to the mail id given in extra.h file.
then i’ve added domains using vadddomain in the same qmail server
but the mails sent to / from the subdomains are not forwarded to the mail id given in extra.h file.
do we need to do anything specfic for sub domains for the changes in extra.h to be in effect?
thanks in advance
INFORMATION:
domain name: test.com
subdomain: sub.test.com
mail id given in extra.h: [email protected]
regards
Sundar
September 27th, 2008 at 9:36 am
Hi Sundar,
I haven’t tried testing this on subdomains, but technically this should be covered by the config. What does your logs says with regards to mail from subdomains? Any errors or may be useful information?
September 29th, 2008 at 3:22 pm
Hi,
Thank you for the reply.
We have checked the log files. There seems to be no message in it regarding the sub domain mails.
We have checked the “[email protected]” mail account and it contains the mails that are sent to the mail ids of test.com domain. but not a single that is sent to “sub.test.com”
is there any other way to find out, whether the sub domain mails are getting processed?
Thanks for your help.
regards
Sundar
September 30th, 2008 at 1:55 pm
Hi,
just a clarification.
After implementing the changes in extra.h and recompiled it, Have you added any new domains?
If so, are the mails to that new domain forwarded as per extra.h or not?
so, should we recompile qmail, for the changes (that are done in extra.h) to be in effect for the newly added domains.
if so, do we need to recompile qmail everytime we add new domains?
regards
Sundar
October 4th, 2008 at 5:17 pm
Sorry for the late reply. I had been busy for quite some time.
Anyway, I have yet to refresh my memory on qmail since it’s been a while that I haven’t used it.
I’ll get back to you as soon as I have something that might be useful.
October 4th, 2008 at 5:31 pm
hi
thank you
i’ll also check. if anything turns out, wil update it here
regards
Sundar
October 19th, 2008 at 6:36 pm
thanks all of u
i need just a clarification
i just want to save only outgoing messasge to single account.
but change in extra.h will forword all outgoing and incoming messasge.
its very urgent. and I need it very much.
thanks in advance
October 21st, 2008 at 4:13 pm
Hi sunil,
Sorry for the late reply. Been busy for a while. Anyway, I don’t get your problem since as far as I know the change on extra.h would only forward outgoing messages to a single account and not incoming messages. Have you tried this to confirm this is what’s happening in your case?
November 22nd, 2008 at 6:33 am
Do you think this can be done on a multi-domain server with having just certain domains copying messages? Ex. server hosts mydomain.com and yourdomain.com. yourdomain.com needs the messages copied for legal reasons and mydomain.com doesn’t.
Thanks
November 28th, 2008 at 6:16 pm
Hi Craig,
I haven’t encountered such setting yet and honestly speaking I don’t think it’s possible with the default settings I mentioned here. Then again, you can always try hacking the codes to fit your needs.
March 11th, 2009 at 5:46 pm
Haha ^^ nice, is there a section to follow the RSS feed