I'm using a mailing list for a very specific application. All the e-mails arrive in a standard - but unfriendly format.
How do I reformat them? If I could filter the messages through a unix script, that'd do the job perfectly. Is there a way to get mailman to pass e-mails through a script before sending them?
What I'm actually trying to do is that the message arrives something like this:
" Subject: Message from #343223 at 16:50 on 16/07/2014 Body:
Dear X,
Here is the from #343223 at 16:50 on 16/07/2014
J.Smith|Logged a message|Urgent|16:50 on 16/07/2014|Subject:Incident|Description:The machine is broken| |How do I fix it?|Status:New|Telephone:01423435|e-mail:J-Smith@smiths.co.es|16:50 on 16/07/2014|Location:Head Office| MessageID:343.@co.es.4212
"
What I'd like to turn this into is:
Subject: URGENT Incident - Logged by J.Smith at 16:50 on 16/07/2014 Message:
URGENT Incident - J.Smith - Telephone:01423435 e-mail:J-Smith@smiths.co.es
The machine is broken How do I fix it?
Location: Head Office
"
What's the best way to achieve that?
All the messages have exactly the same format, so it'd be really easy to write an awk filter to do this, and that'd be my preferred option - but I've no idea where to put the script or how to ask mailman to use it.
To complicate matters a little bit, I'm using a hosted machine, so I have to do everything through CPANEL.
If this isn't possible, my next option would be to send the messages to a machine I do have control over - so, if there's a way to do this that needs root access then I'd like to know that too, because that's plan C.
[My Plan A was to get the originating machine to send nicely formatted messages in the first place, but I've not managed that and run out of time..]
On 07/17/2014 04:12 AM, Peter Brooks wrote:
All the messages have exactly the same format, so it'd be really easy to write an awk filter to do this, and that'd be my preferred option - but I've no idea where to put the script or how to ask mailman to use it.
You need a custom handler for your list. See the FAQ at <http://wiki.list.org/x/l4A9>. The Python handler could do the reformatting itself or call awk to do it.
To complicate matters a little bit, I'm using a hosted machine, so I have to do everything through CPANEL.
Then you probably can't do this.
If this isn't possible, my next option would be to send the messages to a machine I do have control over - so, if there's a way to do this that needs root access then I'd like to know that too, because that's plan C.
You could have the originating machine send the message to your machine which would reformat it and send the reformatted message to the list on the cPanel machine.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Thu, 17 Jul 2014, Peter Brooks wrote:
I'm using a mailing list for a very specific application. All the e-mails arrive in a standard - but unfriendly format.
How do I reformat them? If I could filter the messages through a unix script, that'd do the job perfectly. Is there a way to get mailman to pass e-mails through a script before sending them?
I'd say you're thinking about this the wrong way. I'd make sure they're formatted correctly before Mailman ever sees them. Instead of having your MTA deliver them to Mailman, change the alias to deliver them to a script to reformat them, then have the script send them to Mailman.
To complicate matters a little bit, I'm using a hosted machine, so I have to do everything through CPANEL.
As Mark replied as I was writing, this is a problem.
If this isn't possible, my next option would be to send the messages to a machine I do have control over - so, if there's a way to do this that needs root access then I'd like to know that too, because that's plan C.
See above - I think plan C is the way to go.
-- Larry Stone lstone19@stonejongleux.com
participants (3)
-
Larry Stone -
Mark Sapiro -
Peter Brooks