Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3497126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:19:58+00:00 2026-05-18T12:19:58+00:00

im using procmail to forward emails to different folders in my Maildir. I use

  • 0

im using procmail to forward emails to different folders in my Maildir.
I use these two lines to get the FROM and TO from the mail, which works pretty fine.

FROM=`formail -x"From:"`
TO=`formail -x"To:"`

These two commands return the whole line without the From: and To: prefix.
So i get something like:

Firstname Lastname <firstname.lastname@mail-domain.com>

Now i want to extract the email between < and >.
For this i pipe the variable FROM and TO grepping it like this.

FROM_PARSED=`echo $FROM | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*'`
TO_PARSED=`echo $TO | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*'`

But when i print FROM_PARSED into the procmail log by using LOG=FROM_PARSED, i get an empty string in FROM_PARSED and TO_PARSED.

But if i run these commands on my console, all works fine. I tried many other grepping methods, using grep, egrep, sed and even cut (cutting < and >). All working on console, but i use it in procmail it just returns nothing.

Is it possible that procmail is not allowed to use grep and sed commands? Something like a chroot?

I dont get any error logs in my procmail log. I just want to extract the valid email address from the FROM and TO line. Extracting with formail works, but parsing it with grep or sed fails, even if expression is correct.

Could somebody help? Maybe i need to setup procmail somehow.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:19:58+00:00Added an answer on May 18, 2026 at 12:19 pm

    Strange.

    I added this to the users .procmailrc file

    SHELL=/bin/bash
    

    The users shell was set to /bin/false, which is correct because its a mail user, no ssh access at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Python script to process emails returned from Procmail . As suggested
I want to collect certain information from people/devices via email. These emails will never
Using PyObjC , you can use Python to write Cocoa applications for OS X.
I'm on Ubuntu Intrepid, using Postfix and SpamAssassin. I've seen approaches using procmail (like
Using an access token with offline_access (which I believe is the ultimate and most
Using the below XML, I need to figure out which person worked more hours
Using Javascript, is there a standard way to get the absolute path of an
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
I am attempting to pull some information from my tnsnames file using regex. I
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.