Linux Setup Notes

name and address
last updated may 25, 2013

Pine email problems

A lpine, or "pine" as most people still call it, is a text-mode email client in Linux. There is also a version for Windows. Although it's generally well-behaved, when it has problems it's hard to diagnose them.

Pine hangs sending email

One problem occurs when Pine hangs while sending an email message, saying "Sending message ... 0%". The only way to escape is to log in on another terminal and kill pine on the command line. There are no messages to system or mail logs. Root can still send mail using pine, while regular users can't.

Solution: If the sendmail binary has the wrong permissions or ownership, pine will hang. This happened to me when I installed a new version of pine. One of the Suse configuration files called by Yast2 was the culprit. Changing the ownership back with
chown root.smmsp /usr/sbin/sendmail
fixed it. If you installed sendmail manually, it should be:
-r-xr-sr-x 1 root smmsp 626561 2008-03-17 21:21 /usr/sbin/sendmail

Also, it has been reported that the user's .pinerc file getting corrupted can cause this.

Update Later versions of sendmail (≥8.14) will cause pine to hang if the sendmail binary is set guid. This is done automatically by sendmail's installation program. If necessary, use chmod to set it to 0555.
chmod g-s /usr/sbin/sendmail
ls -l /usr/sbin/sendmail
-r-xr-xr-x 1 root smmsp 681439 Mar 5 10:59 sendmail

Pine will also hang if the permissions or ownership of the user's inbox file in /var/spool/mail are wrong.

421 SMTP connection went away

Solution: Ownership or permissions of sendmail binary are wrong. Or, sendmail is not running. Or, the permissions of /var/spool/mail, /var/spool/mqueue, or /var/spool/clientmqueue are wrong. Clientmqueue is often problematic, because setting permissions to 777 causes sendmail to complain about unsafe permissions, while 770 prevents regular users from sending mail.

Problem: Error sending: SMTP greeting failure: 421 SMTP connection broken (reply)

Solution: Ownership or permissions of sendmail binary are wrong.

Searching through all messages in a folder for a text string

Many people are confused about how to search mail folders in pine.

Pine's search function is context-dependent. If you're in a folder list, it searches through all the folders and marks folders that match. If you're in a mail folder, it searches only in that folder and marks messages that match. Pine calls it "selecting" and not searching. The information below, which is from, describes how to do it. (As an aside, it's a misnomer to call them "folders" because each "mail folder" is actually a file.)

  1. In pine, type S C and set the enable-aggregate-command-set option. If it doesn't have this option, you must upgrade to a newer version of pine.
  2. Open your folder list.
  3. Type ';'. At the bottom, it will say: SELECT criteria :.
  4. Type 'T' to search for a specific text string, 'P' to search for all messages having a specific property (such as "unread"), 'C' to search only the currently highlighted one, or 'A' to search all of them.
  5. If you're in a specific folder, the options are: ? Help, A Select All, C Select current, N Number, D Date, T text string, S status, Z size, K keyword, or R rule.
  6. If you type a "T", it will say: String in folder CONTENTS to match :. Enter the text to search for and press Enter. Pine ignores case.
  7. Pine then marks all the folders containing the search string with an "X" on the left. You can then type 'Z' to "zoom in" or view only the selected folders. If you're in a folder, it will mark the individual messages with an "X" on the left instead.
  8. You can search for a second string within the selected items by pressing ';' again.

Using grepmail with pine

Grepmail is an alternative way to search for text in messages. The principle here is, you type a command on the Unix command line, and grepmail creates a new mail file for you containing the text you searched for. Since it's grep, you can use regular expressions to do very sophisticated searches. You then use pine (or some other email client, or a text editor) to view the results. In this example, we will call the new file "junk."

  1. Log into server
  2. cd mail (or cd Mail) -- may be totally different, because case is important in Unix.
  3. Type one of the following:

    To find the word dioxide in the saved-messages folder:
    grepmail -e dioxide saved-messages > junk

    To find a phrase containing spaces, enclose in quotes:
    grepmail -e "carbon dioxide" saved-messages > junk

    To find a word in daboss's inbox:
    grepmail -e dioxide /var/spool/mail/daboss > junk

    This will create a new folder named "junk" containing all the messages with the word “dioxide.”

    If you know grep syntax, you can do more sophisticated searches.

  4. Log out
  5. Open the "junk" folder in pine or a text editor.
See also Setting up sendmail.