[opensuse] Procmail: Filter & Resend
Hi All, I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression. How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ? Regards, Feris -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Feris Thia wrote:
Hi All,
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Regards,
Feris
man procmailex contains lots of examples... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGN3a9asN0sSnLmgIRAtdwAKDBvDdqw8U1TSw29rtiWbWTTZLBywCfQYvd x7ajdZDpXDtxREVfxAiTr8k= =5aq/ -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi G T Smith, Find no suitable one for me. In fact, how to use MATCH variable anyway ? Regards, Feris On 5/2/07, G T Smith <grahamsmith@gandalfsemporium.homelinux.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Feris Thia wrote:
Hi All,
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Regards,
Feris
man procmailex
contains lots of examples... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFGN3a9asN0sSnLmgIRAtdwAKDBvDdqw8U1TSw29rtiWbWTTZLBywCfQYvd x7ajdZDpXDtxREVfxAiTr8k= =5aq/ -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Feris Thia wrote:
Hi G T Smith,
Find no suitable one for me. In fact, how to use MATCH variable anyway ?
Regards,
Feris
On 5/2/07, G T Smith <grahamsmith@gandalfsemporium.homelinux.com> wrote: Feris Thia wrote:
Hi All,
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Regards,
Feris
man procmailex
contains lots of examples...
As Herbert correctly pointed out in his email if you are wishing to get your mail from a server via pop, then fetchmail is the better alternative. (The pull option). If you are having mail forwarded to you (the push option) procmail is possibly the best option if you want to place mail from different servers in different folders etc. Example 2 to 4 on the procmailex man page are all examples of simple mail forwarding rules .... the :0 starts the recipe c is a flag (look at flag definitions) the line with * in front are the match conditions... the match conditions are matched against the header by default (again look at flag definitions), if they are satisfied the line immediately afterwards is the instruction is performed, lines between {..} are considered as one line... the ! is the forward instruction... Syntax is very terse.... - -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGN6C5asN0sSnLmgIRApJzAJ43YYoBPI/1OBvIl1+5JOrlN3Hu2QCgjiB9 UKtlaiE1oFLVyeEM+fxG/9c= =g8VO -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Smit On 5/2/07, G T Smith <grahamsmith@gandalfsemporium.homelinux.com> wrote:
Feris
man procmailex
contains lots of examples...
As Herbert correctly pointed out in his email if you are wishing to get your mail from a server via pop, then fetchmail is the better alternative. (The pull option).
If you are having mail forwarded to you (the push option) procmail is possibly the best option if you want to place mail from different servers in different folders etc. Example 2 to 4 on the procmailex man page are all examples of simple mail forwarding rules ....
Hi Herbert & Graham, Using fetchmail already... That's why I want to intercept with using procmail (which is already succeed using 'mda' option)... But now, I need to extract username@abc.com from RECEIVED field. I search through procmailex but don't comeout with a solution. I think I need to use $MATCH variable. Anyone has any sample for that ?
the :0 starts the recipe c is a flag (look at flag definitions) the line with * in front are the match conditions... the match conditions are matched against the header by default (again look at flag definitions), if they are satisfied the line immediately afterwards is the instruction is performed, lines between {..} are considered as one line... the ! is the forward instruction...
Thanks Graham... these things reassured me that I already done the right thing. Really appreciated that :)
Syntax is very terse....
Regards, Feris -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Feris Thia wrote:
Hi Smit
On 5/2/07, G T Smith <grahamsmith@gandalfsemporium.homelinux.com> wrote:
Feris
man procmailex
contains lots of examples...
As Herbert correctly pointed out in his email if you are wishing to get your mail from a server via pop, then fetchmail is the better alternative. (The pull option).
If you are having mail forwarded to you (the push option) procmail is possibly the best option if you want to place mail from different servers in different folders etc. Example 2 to 4 on the procmailex man page are all examples of simple mail forwarding rules ....
Hi Herbert & Graham,
Using fetchmail already... That's why I want to intercept with using procmail (which is already succeed using 'mda' option)... But now, I need to extract username@abc.com from RECEIVED field. I search through procmailex but don't comeout with a solution. I think I need to use $MATCH variable. Anyone has any sample for that ?
the :0 starts the recipe c is a flag (look at flag definitions) the line with * in front are the match conditions... the match conditions are matched against the header by default (again look at flag definitions), if they are satisfied the line immediately afterwards is the instruction is performed, lines between {..} are considered as one line... the ! is the forward instruction...
Thanks Graham... these things reassured me that I already done the right thing. Really appreciated that :)
Syntax is very terse....
Regards,
Feris
The single line instruction can be used to pass the message to a script for further processing e.g. | my-script as the instruction.... This script can do additional processing including the extraction for you... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGOFHlasN0sSnLmgIRAt+IAJ43l2aNw+XCQcJ6lXgCnLpVPOXBHACg54Yh 1b73KYZYDb3EXW+OYZiJ41w= =K2FT -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Dienstag, 1. Mai 2007 schrieb Feris Thia:
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Why procmail? You may better use fetchmail. This is partly supported by YaST. What's missing is the catch-all case (multi drop mailboxes). This must be configured manually in /etc/fetchmailrc. Look into the man page of fetchmail for details. Cheers, Herbert -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Dienstag, 1. Mai 2007 schrieb Feris Thia:
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Why procmail? You may better use fetchmail. This is partly supported by YaST. What's missing is the catch-all case (multi drop mailboxes). This must be configured manually in /etc/fetchmailrc. Look into the man page of fetchmail for details. Procmail is a mail delivery agent. Fetchmail is a mail retrieval agent. You can use Fetchmail to grab email from your ISP's POP3 or IMAP servers and deliver it to local users on your Linux system. This may be
On Tue, 1 May 2007 19:57:59 +0200 Herbert Graeber <lists@graeber-clan.de> wrote: preferable to the global account at your ISP, but that depends on many factors. With procmail you can use a number of rules to deliver email as you know. The problem is that there are a number of Received fields. One thing you could do is similar to the way we use Spamassasin, is to pipe the message through a program or script that you write, and add a unique field that you can key on. Here is my .procmailrc generic spamc rule. :0fw: spamassassin.lock * < 256000 | spamc So, you could use something like: :0fw:mycode.lock | mycode Mycode would then create a header line, such as "mycode: username" Then you would create a simple set of rules for the new header line you inserted. There may be a more elegant way of doing this, but it should work. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Am Mittwoch, 2. Mai 2007 schrieb Jerry Feldman:
On Tue, 1 May 2007 19:57:59 +0200
Herbert Graeber <lists@graeber-clan.de> wrote:
Am Dienstag, 1. Mai 2007 schrieb Feris Thia:
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ?
Why procmail? You may better use fetchmail. This is partly supported by YaST. What's missing is the catch-all case (multi drop mailboxes). This must be configured manually in /etc/fetchmailrc. Look into the man page of fetchmail for details.
Procmail is a mail delivery agent. Fetchmail is a mail retrieval agent. You can use Fetchmail to grab email from your ISP's POP3 or IMAP servers and deliver it to local users on your Linux system. This may be preferable to the global account at your ISP, but that depends on many factors.
But fetchmail has the ability to evaluate the Received fields or (better) other custom fields added by the ISP that contain the envelope of the emails.
With procmail you can use a number of rules to deliver email as you know. The problem is that there are a number of Received fields. One thing you could do is similar to the way we use Spamassasin, is to pipe the message through a program or script that you write, and add a unique field that you can key on. Here is my .procmailrc generic spamc rule.
:0fw: spamassassin.lock
* < 256000
| spamc
So, you could use something like: :0fw:mycode.lock : | mycode
Mycode would then create a header line, such as "mycode: username" Then you would create a simple set of rules for the new header line you inserted.
Sure, procmail is a useful and flexible tool. But for getting mail from a multi drop mailbox and delivering it into separate mailboxes via postfix or sendmailm, fetchmail works better. You can even use procmail for other tasks, too.
There may be a more elegant way of doing this, but it should work.
Even when I think fetchmail is better for the task of loading and sorting mails from multi drop mailboxes, this is not elegant too, because multi drop mailboxes itself are a kludge. Cheers, Herbert -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Herbert Graeber wrote:
Am Mittwoch, 2. Mai 2007 schrieb Jerry Feldman:
On Tue, 1 May 2007 19:57:59 +0200
Am Dienstag, 1. Mai 2007 schrieb Feris Thia:
I have a global (catch-all) account at my ISP. In my Linux box I need to download all the emails from the account and want to delivered it to local user's inbox. I've just learned about .forward and .procmailrc and have no problem with Regular Expression.
How do I match an email's address pattern (username@abc.com) from RECEIVED field in mail's header and then resend it ? Why procmail? You may better use fetchmail. This is partly supported by YaST. What's missing is the catch-all case (multi drop mailboxes). This must be configured manually in /etc/fetchmailrc. Look into the man page of fetchmail for details. Procmail is a mail delivery agent. Fetchmail is a mail retrieval agent. You can use Fetchmail to grab email from your ISP's POP3 or IMAP servers and deliver it to local users on your Linux system. This may be
Herbert Graeber <lists@graeber-clan.de> wrote: preferable to the global account at your ISP, but that depends on many factors.
But fetchmail has the ability to evaluate the Received fields or (better) other custom fields added by the ISP that contain the envelope of the emails.
With procmail you can use a number of rules to deliver email as you know. The problem is that there are a number of Received fields. One thing you could do is similar to the way we use Spamassasin, is to pipe the message through a program or script that you write, and add a unique field that you can key on. Here is my .procmailrc generic spamc rule.
:0fw: spamassassin.lock
* < 256000
| spamc
So, you could use something like: :0fw:mycode.lock : | mycode
Mycode would then create a header line, such as "mycode: username" Then you would create a simple set of rules for the new header line you inserted.
Sure, procmail is a useful and flexible tool. But for getting mail from a multi drop mailbox and delivering it into separate mailboxes via postfix or sendmailm, fetchmail works better. You can even use procmail for other tasks, too.
There may be a more elegant way of doing this, but it should work.
Even when I think fetchmail is better for the task of loading and sorting mails from multi drop mailboxes, this is not elegant too, because multi drop mailboxes itself are a kludge.
Cheers, Herbert
I think someone wandered off point here :-) The original poster indicated in reply that he was using fetchmail to obtain mail but that he wanted to perform some additional processing of the mail before it was delivered. Fetchmail is strongest at getting mail and delivering it to appropriate mail boxes but has NO facilities to pre process mail before delivery. Procmail gives one the facility to pre process mail, and I personally use it for a) spam processing and b) for moving some low priority mail from the mail box so that I should only see stuff I am interested in when I access mail from my Nokia. (Saves bills..:-)) This pre processing can involve forwarding mail, for external mail fetchmail would be best but for mail delivered locally procmail is more effective. Horses for courses... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGOZ+JasN0sSnLmgIRAv3KAJ9sAo+AHECASj4fupGBcrqwJ9t5YQCgzL5m /RkgEwgGN7/wf3UKVQJLbwI= =CWJ/ -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Feris Thia
-
G T Smith
-
Herbert Graeber
-
Jerry Feldman