LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-19-2011, 05:23 AM   #1
golden_boy615
Member
 
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Rep: Reputation: 18
how to use sender or any thing in header as name of storing mail file in procmailrc


hello
I want to know how can I use sender an receiver of the email in name of file for storing mail in procmailrc. I made one but it does not work.

Quote:
SUBJECT=`formail -xSubject:` # regular field
FROM=`formail -rt -xTo:` # special case

:0 b
* ^FROM.*
| sed -e '/^To: +\?[0-9]*$/,/report/!d' > ${FROM}${SUBJECT}--`mktemp 20\`date +%y-%m-%d-%S--\`XXXXXX`
it works when I use :
Quote:
| sed -e '/^To: +\?[0-9]*$/,/report/!d' > `mktemp 20\`date +%y-%m-%d-%S--\`XXXXXX`
what is wrong with my recipe?
 
Old 04-21-2011, 12:26 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by golden_boy615 View Post
what is wrong with my recipe?
AFAIK you can use variables used for delivery something like this (do test!):
Code:
SUBJECT=`formail -xSubject:`
FROM=`formail -rt -xTo:`
DELIVERYTO=$(eval echo "${FROM}${SUBJECT}"|sed -e '/^To: +\?[0-9]*$/,/report/!d')

:0 wic
* ? test ! -f ${DELIVERTO}
| touch ${DELIVERTO}; chmod 0600 ${DELIVERTO}

:0 b
 * ^FROM.*
${DELIVERTO}
but unless you have compelling reasons to do so I would strongly advice against doing this for -=ALL=- email as errors in sender address, subject line and overhead from using core utilities may adversely affect system performance or b0rk it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] does procmailrc conditions just work on mail header golden_boy615 Linux - General 3 04-19-2011 08:48 AM
Removing e-mail header in text file Ole Juul Linux - General 8 03-11-2009 04:28 AM
cannot send mail using Mail::Sender cccc Programming 2 11-02-2007 02:27 AM
Configuration of wireless sender thing :P Mondus Linux - Software 1 08-01-2005 03:23 PM
I want change mail header info, which config file i should modify? exper Linux - Software 2 12-05-2003 06:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration