Custom Search



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. :D

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% [?]

14 Responses to “Qmail Carbon Copy of Outgoing Messages”

  1. bob Says:

    fduMzq hi nice site man thx http://peace.com

  2. Sundar Says:

    much useful info; thanks a lot; rating: 5 stars (out of 5)

  3. girls2008d Says:

    cup

  4. Sundar Says:

    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

  5. HyperAxe Says:

    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?

  6. Sundar Says:

    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

  7. Sundar Says:

    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

  8. HyperAxe Says:

    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.

  9. Sundar Says:

    hi

    thank you

    i’ll also check. if anything turns out, wil update it here

    regards
    Sundar

  10. sunil Says:

    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

  11. HyperAxe Says:

    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?

  12. craig Says:

    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

  13. HyperAxe Says:

    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.

  14. guasha Says:

    Haha ^^ nice, is there a section to follow the RSS feed

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes