Re: [exim] How to log the generated outgoing message-id?

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Phil Pennock
Ημερομηνία:  
Προς: Ferenc Wagner
Υ/ο: exim-users
Αντικείμενο: Re: [exim] How to log the generated outgoing message-id?
On 2008-08-22 at 16:10 +0200, Ferenc Wagner wrote:
> Jeremy Harris <jgh@???> writes:
>
> > Ferenc Wagner wrote:
> >
> >> For tracking email, I'd like to log the message-id generated by Exim
> >> for mail submitted by a local process. How could I achieve this?
> >
> > Look in the docs at http://exim.org for "log_message" and "$message_id"
>
> OK, I cooked up this:
>
> acl_not_smtp = acl_log_message_id
> begin acl
> acl_log_message_id:
> warn log_message = Generated message id: $message_id
> accept
>
> And mainlog says:
>
> 2008-08-22 15:53:12 1KWX4i-0002NF-0C U=wferi Warning: Generated message id: 1KWX4i-0002NF-0C
> 2008-08-22 15:53:12 1KWX4i-0002NF-0C <= wferi@mydomain U=wferi P=local S=341
>
> Which makes me feel stupid. Apparently each log line is prefixed with
> the message id, sort of. Because in the received mail I find:
>
> Message-Id: <E1KWX4i-0002NF-0C@mydomain>
>
> Where does the E prefix come from?


There are two different "message ids" here.

There's $message_exim_id, which used to be called $message_id;
$message_id still works, for backwards compatibility, but the name is
confusing, which is why it became $message_exim_id. And there's the
"Message-Id:" header value.

Exim always logs its internal $message_exim_id for mails. This is the
"handle" used to identify all mails passing through Exim; things like
files on the spool have names based on this value, it's put into the
"Received:" header, etc.

If there is not already a Message-Id: header, then Exim creates one. By
default it uses E${message_exim_id}@$primary_hostname to construct it.
You can change the "domain" part with message_id_header_domain and you
can add something extra just before the @ with message_id_header_text.

The 'E' prefix is there for the "external" form of the internal
$message_exim_id; I don't know why, but I'll guess that it's best if
the Message-Id *always* starts with a letter [*] and that it sometimes
helps to have a visual marker so you can tell, when people cut&paste
information, where the data is coming from. I've no idea if it stands
for 'Exim' or 'External' or both.

-Phil

[*] "best" not because any standard requires it but to minimise problems
    with buggy software which puts in bogus checks.  This is purely
    hypothesis.