Questions tagged [mail-command]

The mail, Mail and mailx command line utilities

Unix has included a mail command] since version 1, when mails were only delivered to other users of the same machine. Today, all unix variants include a command called mail which can send and receive Internet email, but its capabilities vary. Some systems include a Mail or mailx command as well.

Use this tag if you have a question about the mail, Mail or mailx utility. Be sure to mention what operating system and distribution you are using.

If your question is about email in general, use the tag .

The mailx command is standardized in POSIX.

119 questions
41
votes
1 answer

How can I list the messages in my mailbox?

Using the mail command it shows the messages I have and drops me into a prompt, but I cannot figure how to list the messages. Here is the help screen for mail: Mail Command Description ------------------------- …
Tyler Durden
  • 5,631
20
votes
2 answers

Does the mail command require a mail server?

Does one need to set up a mail server before being able to use the linux mail command?
puk
  • 333
7
votes
3 answers

Delete Mail Based on Subject Pattern [mail-command]

Is it possible to delete all mail in which the subject matches a regex pattern? For example, to delete message 1, you do: d 1 But to delete all mail with subject starting with, say, [SPAM], I can't do: d -s "^\[SPAM\].*$"
nehcsivart
  • 611
  • 7
  • 14
5
votes
4 answers

How do I open mail using vim?

I scheduled a task using at. The output of the scheduled job was sent to mail. But the output is quite huge; I prefer reading it in a text editor. Additionally, I don't want to forward the mail, I just want to read locally. I hope there is a…
3
votes
3 answers

How can I connect mail(1) to my Gmail/Yahoo/Hotmail account?

I would like to use the mail command in a shell script to automatically connect to my Gmail/Yahoo/Hotmail account and send/receive messages. How can I do this?
fouric
  • 2,281
3
votes
1 answer

`mail` command - How can I display the email list again?

When using the mail command, I automatically get the list of the emails received: user@server:~ $ mail "/var/mail/user": 4 messages 4 unread >U 1 mail1 Tue Dec 17 13:13 18/628 junk_mail U 2 mail2 Tue Dec 17 13:14 18/628 …
1
vote
0 answers

how to read postfix mail from command line

I have setup postfix server and set home_mailbox = Mail/. How to make mail read mail from ~/Mail/. I tried ln -s ~/Mail /var/mail/$USER but mail complains Cannot open mailbox /var/mail/$USER: Is a directory
Necktwi
  • 1,026
0
votes
1 answer

How do I pass a script argument to a pipelined argument?

I have the following code and I wanted the argument to -s to include the first argument of my bash script. Currently it prints "$1" verbatim for subject though the message body has $1 evaluated correctly in the echo statement echo "Converse Log…
0
votes
1 answer

how can I tell the mail command the path to sendmail?

I would the mail command to use a program other than /usr/sbin/sendmail. e.g. $ mail --path=/usr/local/bin/mysendmail someone@somewhere.com How can I do this?
-1
votes
1 answer

How to clear old mail in Linux?

I want to clear the Linux mail for my account every day at 10pm. How can I accomplish it?
bhattedon
  • 111
  • 2