Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

embedding line in mail header

by perlknight (Pilgrim)
on Apr 30, 2006 at 05:07 UTC ( #546553=perlquestion: print w/replies, xml ) Need Help??

perlknight has asked for the wisdom of the Perl Monks concerning the following question:

all, I have several servers which runs batch jobs. These batch jobs sends out email when completed. I have no issue telling which email comes from which server. However, I sometimes have a hard time tracking down which script it comes from. I am wondering if it is possible to embed the name of the script in the mail header without causing problem with email. Any idea how?

2006-05-01 Retitled by planetscape, as per Monastery guidelines
Original title: 'embeding line in mail header'

Replies are listed 'Best First'.
Re: embedding line in mail header
by Zaxo (Archbishop) on Apr 30, 2006 at 05:33 UTC

    You can devise your own header in the "X-mumble" space, or else put it in Comments. Call it, say, X-SourceScript, and fill it in with $0 when you set up headers for the mail.

    my $msg = MIME::Lite->new( From =>'', To =>'', Cc =>',', Subject => $title, X-SourceScript => $0, Data => $message );

    The MIME::Lite pod has more about other forms of custom headers.

    After Compline,

Re: embedding line in mail header
by eXile (Priest) on Apr 30, 2006 at 05:19 UTC
    It is a custom (not sure whether/where it is documented), to start custom headers with X-. Email servers and clients don't touch these X-headers. You could add your scriptname like:
    Subject: testmail
    X-Scriptname: /usr/local/bin/
    PS: oh, the joy I had adding X-wing or X-mas headers to email ...

    PS2: X-headers are actually documented in RFC822 (

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://546553]
Approved by Zaxo
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-04-02 09:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found