LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-13-2019, 06:36 PM   #16
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 99

Original Poster
Rep: Reputation: Disabled

I was wondering does anybody know how do I make this normal regular expression into this "weird" procmail's regular expression with its crazy adjustments and its own rules? Is it possible at all?
Code:
/^From:\sName\sLastname\s\<address9\@gmail\.com$/
 
Old 06-13-2019, 06:56 PM   #17
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,068

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Quote:
Originally Posted by Klaipedaville View Post
I was wondering does anybody know how do I make this normal regular expression into this "weird" procmail's regular expression with its crazy adjustments and its own rules? Is it possible at all?
Code:
/^From:\sName\sLastname\s\<address9\@gmail\.com$/
Sorry I didn't get back to you. I've been mulling the problem.
You don't need to change your match.
Code:
* ^From.*address9\@gmail.com
will (er, should) match that address as follows:
from the start of the line (^) match the literal From, followed by any number of any character, followed by the literal address9@gmail.com.
As suggested earlier, even
Code:
* ^From.*address9
should match if that's the only email you receive with "address9" in the From line. I use that form for whitelisting email addresses...I only match on the username part. Works just fine. Did you give that a try? Just to see what happens?

Again, recommend stripping things out of your recipe until it works, starting with the action line.

Did you try removing the flags?
 
Old 06-13-2019, 07:14 PM   #18
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 99

Original Poster
Rep: Reputation: Disabled
Thanks. I'll get back to you / to it tomorrow. I am in the middle of the night here and just falling asleep.

Well, I have been experimenting of course. The thing I am reading now is this procmail's regular expressions because they are darn different from "regular" regular expressions and when I know for a fact that "normal" regular expressions will work for sure it may not be the case for procmail's regular expressions.
 
Old 06-13-2019, 08:29 PM   #19
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,068

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
There are some differences, of course, but what Iím saying is from my .procmailrc ó REs that are working for me there.
What version are you using...Iíll check my version and post here later, too.
 
Old 06-14-2019, 01:33 AM   #20
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 99

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Sorry I didn't get back to you. I've been mulling the problem.
You don't need to change your match.
Code:
* ^From.*address9\@gmail.com
will (er, should) match that address as follows:
from the start of the line (^) match the literal From, followed by any number of any character, followed by the literal address9@gmail.com.
As suggested earlier, even
Code:
* ^From.*address9
should match if that's the only email you receive with "address9" in the From line. I use that form for whitelisting email addresses...I only match on the username part. Works just fine. Did you give that a try? Just to see what happens?

Again, recommend stripping things out of your recipe until it works, starting with the action line.

Did you try removing the flags?
OK.

1. Removing the flags didn't help.
2. Setting it to this * ^From.*address9 that is to address9 without @gmail.com didn't help.

I have now stripped everything leaving only the From field:

1. The following is not working either * ^From.*\s.*address9 (assuming that the first .* are the "must be" there as the mandatory part of the procmail's *^From.*)
2. Now I am trying to match every single symbol / character in my From field because it is always the same but I cannot seem to figure out how to convert regular expressions into procmail expressions. (procmail expressions are a way too different from regular expressions). This is the one I am trying to convert as putting it there as it is doesn't work:
Code:
 /^From:\sName\sLastname\s\<address9\@gmail\.com$/
My next steps will be to try to match against * ^To: and against * ^Subject: fields only with everything else stripped.

Do you happen to know why there is always a colon after To: (* ^To:.*) and you never put any colons after From (* ^From.*). Beats me. I can only test it out to find out just by putting one in there if... it outputs any results at all...
 
Old 06-14-2019, 02:44 AM   #21
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,068

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Quote:
Originally Posted by Klaipedaville View Post
OK.

1. Removing the flags didn't help.
2. Setting it to this * ^From.*address9 that is to address9 without @gmail.com didn't help.

I have now stripped everything leaving only the From field:

1. The following is not working either * ^From.*\s.*address9 (assuming that the first .* are the "must be" there as the mandatory part of the procmail's *^From.*)
2. Now I am trying to match every single symbol / character in my From field because it is always the same but I cannot seem to figure out how to convert regular expressions into procmail expressions. (procmail expressions are a way too different from regular expressions). This is the one I am trying to convert as putting it there as it is doesn't work:
Code:
 /^From:\sName\sLastname\s\<address9\@gmail\.com$/
My next steps will be to try to match against * ^To: and against * ^Subject: fields only with everything else stripped.

Do you happen to know why there is always a colon after To: (* ^To:.*) and you never put any colons after From (* ^From.*). Beats me. I can only test it out to find out just by putting one in there if... it outputs any results at all...
The From header will always be
Code:
From:
(From colon space)
But... .* (dot .)will match the colon so the regex
Code:
^From:.*
and
^From.*
are functionally equivalent.

To my earlier question
Code:
# procmail -v
procmail v3.22 2001/09/10
What's your version?
 
Old 06-14-2019, 05:02 AM   #22
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 99

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
The From header will always be
Code:
From:
(From colon space)
But... .* (dot .)will match the colon so the regex
Code:
^From:.*
and
^From.*
are functionally equivalent.

To my earlier question
Code:
# procmail -v
procmail v3.22 2001/09/10
What's your version?
Mine is the same
Code:
procmail v3.22 2001/09/10
Boy my stupid!... I think I found the problem. I couldn't have forgotten how to code all of a sudden and just out of the blue. I had a hunch that there was something else because it didn't really look procmail related as all the regexes were correct. I have this postfix script written which I re-directed my transport_maps over to, which in turn are required to run procmail in postfix. This mailpipe/script of mine runs per each email account separately, so that's why I didn't work for one email address but worked perfectly fine for another one.. geee... let me double-check it... this is what happens when you don't write proper notes and do not document your scripts properly... man... but then again I haven't touched it for about 5 years so no wonder it slipped my mind.. There are only a few checks left to run in order to confirm that my problem will be solved in a minute..

Yes. All good. All set. Confirmed. The suspect, now already the culprit to be exact is punished. My script is fixed. No issues any more. Thank you Scasey for your follow ups, suggestions, and for your assistance. I really do appreciate.

Last edited by Klaipedaville; 06-15-2019 at 01:16 AM.
 
Old 06-14-2019, 11:29 AM   #23
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,068

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Just to clarify for future visitors:
The problem had nought to do with procmail...yes?

Glad you figured it out, and I'm glad I wasn't going crazy! I sure couldn't see anything wrong with what you were doing...
 
Old 06-15-2019, 12:58 AM   #24
Klaipedaville
Member
 
Registered: Mar 2013
Posts: 99

Original Poster
Rep: Reputation: Disabled
Correct. It had nothing to do with procmail...

Same here. lol I also thought that I went crazy )))
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Three actions in a recipe of Procmail Borelian Linux - Software 1 11-11-2012 06:48 AM
procmail; recipe help; returning notification on overly large emails TheLinuxDuck Programming 2 02-05-2010 01:28 AM
Procmail recipe jebix666 Linux - General 1 06-09-2005 01:43 PM
procmail recipe for charset conversion Peff Linux - Software 0 07-13-2004 02:40 AM
procmail recipe not working? theLIGHT Linux - Software 3 11-18-2002 10:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:52 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration