PDA

View Full Version : Possible options for email forwarding


Mark
03-20-2001, 12:19 PM
Hello everyone,

I'm wondering if I could get some ideas on how to implement the following:

I'd like to take all emails that come into XXXXXX@mydomain.com, add a SUBJECT line and then forward to another email address.

I've started looking at PROCMAIL, but not sure if this is what I need?

Any ideas?

Thanks!!

Mark
http://www.GameGoat.com - Trivia by Email!

sheila
03-20-2001, 11:48 PM
I'm not sure if anyone has been able to get Procmail to run, here at FQ. I tried a bit with it, some time back. But I finally decided I wasn't going to be able to figure it out. Instead, I have been writing some Python scripts to do the type of stuff that you're talking about. For instance, I have written a script that does this:

I have a text file of "Good To" addresses (these are e-mail addresses, that if they are in the To:field of the message, I want to read them for sure). And I have a text file of "Good From" addresses (these are e-mail addresses, that if they are in the From: field, I want to read them for sure). My script checks the headers of each message. Any mail that has a Good To: address or a Good From: address gets forwarded straight to a secret e-mail address that I have given out to no one. Everything else gets a header field added to it:
X-spam: tagged as possible spam

I POP my mail from that secret address and have my e-mail client filter everything with that header in it into a separate "spam folder".

I'm sure it would be possible to accomplish much the same thing with Perl or other scripting languages. The key thing, is that you need to work with the .qmail files, in order to invoke a script when your mail arrives. In any case, even if you go with Procmail, you will still have to invoke it from a .qmail file. The key thread in these forums, I believe, on that topic is here:
http://www.aota.net/ubb/Forum5/HTML/000349-1.html

Here is a link on my site with some Perl scripts that I wrote/stole/modified that do some things with the mail system here at FQ.
http://www.thinkspot.net/sheila/computers/perl.html

If you do get Procmail to work, or if anyone here at FQ has managed to get Procmail working, PLEASE share your tips and techniques!

Hope this helps,
sheila

Terra
03-21-2001, 05:38 AM
Is there already a 'Subject:' header or not?

--
Terra
sysAdmin
FutureQuest

Mark
03-21-2001, 08:57 AM
Terra,

If there is a subject line on the incoming email, it will have to be changed. (It will always be changed to the same thing).

FWIW: Most times it will be coming in with a subject that my 2-way pager puts in automatically and doesn't allow me to modify.

-- Mark

Terra
03-21-2001, 11:36 AM
Search through the forums for: perl filter qmail-command

Both Justin and myself have written up a bunch of stuff over time and are little gold nuggets strewn about in the forums...

pseudo:</font><font face="Courier" size="3">
while (<>) {
[nbsp][nbsp]if (/^Subject:/) {
[nbsp][nbsp][nbsp][nbsp]print &quot;Subject: blah blah blah\n&quot;;
[nbsp][nbsp][nbsp][nbsp]#found subject - now let's jam
[nbsp][nbsp][nbsp][nbsp]print <>;
[nbsp][nbsp][nbsp][nbsp]exit(0);
[nbsp][nbsp]}
[nbsp][nbsp]#print all headers/lines before the Subject
[nbsp][nbsp]print;
}
</font><font face="Verdana, Arial" size="2">

Once you get the hang of your environment with qmail-command, you'll find that you can become extremely expressive with perl and writing filters...

--
Terra
--Garbage in - Garbage out--
FutureQuest

Mark
03-21-2001, 12:01 PM
Thanks Terra, I'll do that!

-- Mark

All your qmail-filtering are belong to us :)

Terra
03-21-2001, 12:05 PM
LOL!

;)

--
Terra