The mail, Mail and mailx command line utilities

learn more… | top users | synonyms

0
votes
1answer
14 views

Postfix forwarding using virtual settings

I have gone over multiple articles which walk me through the process - I feel I understand the what and the why's - but I cannot send a email to test. Here are the steps in detail. Here is a ...
-1
votes
1answer
39 views

How to pipe a cat output to stdin? [closed]

C++ -------> g++ -------> bash : #include <cstdlib> using namespace std; int main(){ system("mail -s test_mail xxxx@testdomain.com"); system("test msg"); system("."); return ...
3
votes
1answer
171 views

Native sendmail commands to operate the mail queue?

I'm on a CentOS 7 server that runs sendmail and unfortunately I'm not allowed to install new packages. Postfix tools are not installed; AFAIK the only tool available is mailq, that permits only to see ...
0
votes
1answer
36 views

Checking for mails

I recently started using mails via UNIX. I would like to create a script , that would write (every time I log in ) something like "The content of your mailbox has changed since last checkup" ...
3
votes
1answer
27 views

How would you build a cron that empties the mail in all mailboxes?

I am new to Unix here. We have some mailboxes that are taking up an incredible amount of space and I'm trying to figure out a way to delete all mail that has been in the box for 30 days. Most of what ...
1
vote
1answer
22 views

mbox still shows mail messages after they have been deleted

I deleted all messages from my mail with mailx d MSGS, and now mailx shows no mail. But why does cat ~/mbox still show all of the supposedly deleted messages?
1
vote
2answers
25 views

Trying to direct variable contents into command gives Ambigious Redirect

I'm trying to write a script which tests the http response from various Node servers I have running and which then emails me if any respond with a 502 error from Nginx (meaning one or more server has ...
-1
votes
2answers
41 views

Script not running! Also how to attach timestamp in mail?

I have the following bash script... #!/bin/bash # Delete JUNK temp folder if [ -d JUNK/FOLDER/PATH ] then rm -rf JUNK/FOLDER/PATH echo "Cleansed JUNK directory successfully!" /usr/bin/mail -s ...
7
votes
3answers
1k views

Executing mail command from inside a function causes a “fork bomb”

When I try to execute mail from inside a function in a bash script it creates something similar to a fork bomb. To clarify, this creates the issue: #!/bin/bash mail() { echo "Free of oxens" | ...
0
votes
0answers
34 views

How to use mail to send an email to my friend?

Firstly, I use command apt-get install mailutils on my Ubuntu14.04 system, and the terminal shows a dialog "Postfix Configuration", I choose the first option "no configuration". Then I try to use the ...
0
votes
1answer
21 views

`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 ...
2
votes
1answer
217 views

Trying to send multiple text attachments via mail message

Running this script on: "Red Had Enterprise Linux Server release 5.11 (Tikanga)" Mail is: version 8.1 6/6/93 (appears quite old). Have tried various things and cannot seem to get this to work.. ...
0
votes
0answers
68 views

Saving attachment from mail

I am using this command to send email with attachment and message body: echo "Message body" | mail -s "Temat" -a myFile student7 And this is how I try to extract this file (inside mail): ? s file ...
4
votes
4answers
627 views

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 dont want to forward the mail I just ...
0
votes
1answer
640 views

sending multiple attachment using uuencode

I want to send multiple CSV file using below code. In Result folder, we have multiple CSV files. However, I want to catch only Summary CSV files. I was trying using *, % with different combination. ...
2
votes
2answers
150 views

Why is mail-utils / cron sending out so many emails?

I was trying to troubleshoot why my Raspberry Pi isn't sending emails with ssmtp / mail-utils, and so I opened up my gmail account that I use for the Pi. To my surprise, there were 15k unread emails ...
1
vote
0answers
173 views

systemd MAILTO-replacement failing

I'm trying to setup systemd to notify me via email if a unit fails, like Cron can be set up to do. I followed the guide on the Arch Linux wiki. So I set-up a sendmail shell script in ...
0
votes
3answers
3k views

Set sender name in mail function

How can I set sender name and email address using mail command in shell script.
2
votes
1answer
356 views

Why cron jobs' output keeps getting written to ~/dead.letter?

I have a job scheduled by cron running every day, and the job is about compressing a folder using tar; and I found that the standard output of tar keeps getting written into ~/dead.letter everyday. ...
0
votes
1answer
432 views

On Linux, what is the “mail” user account for?

The title says it all; there's an account mail and a group by the same name on my system, what's its purpose ? It owns the /var/spool/mail directory (empty currently). I plan to use that directory, ...
2
votes
1answer
68 views

How can I change the from address in *nix mail globally?

I know that you can change the from address in *nix mail by specifying command-line options. However, is there a way to set it globally, so that it is respected by forwarding? I tried modifying the ...
4
votes
1answer
380 views

How can I forward local *nix mail to an external account while keeping the local copy?

On my Raspbian server, I wish to have local *nix mail delivered locally, as well as to an external address. /home/pi/.forward contains pi,foo@bar.com. I've run sudo dpkg-reconfigure exim4-config with ...
1
vote
1answer
739 views

Stopping postfix - are messages queued when postfix is idle?

I am running some scans on my server tonight and would like to disable email notifications since there is a chance for a LOT of them to be sent out. I am planning to issue service postfix stop ...
3
votes
1answer
864 views

How does the mail command work?

I am curious as to how the mail command works. My computer has postfix server installed by default with red hat and is connected to a network that includes a mail server. I had assumed that when I ...
1
vote
0answers
51 views

BSD Mail - Single Sending Address

I've been working on sending HTML emails using BSD mail and so far I've been successful. I've even been able to modify, not change though, the sender. Current Command: cat $htmlFile | mail -s ...
0
votes
2answers
2k views

When does Linux send a root mail and how to force it for testing purposes?

Let's say I want to test root mail functionality after I set up nullmailer, how do I force my Debian Linux system to send a root mail? And furthermore on which events does Linux send root mails at ...
1
vote
2answers
630 views

Need to delete mails for a range of dates in Linux

I have 1 million mails generated in a Linux sever due to a cron job. I want to delete the mails, but not all as this cron mails useful to troubleshoot and find out the issue with cron job's execution. ...
1
vote
1answer
97 views

sending emails with heirloom, even when Postfix is not running locally

Normally, I can send email from commandline, such as echo hello | mail -s "subject" user@example.com I have noticed that even when Postfix is not running on my machine, I can still "send" emails. ...
0
votes
0answers
42 views

Invalid mail alert

When I log in to Unix, I get new mail alert: [YOU HAVE NEW MAIL] I checked my mail and I don't have any: $ mail Mail [5.2 UCB] [AIX 5.X] Type ? for help. "/var/spool/mail/userId": 0 messages No ...
-1
votes
1answer
285 views

How to save mails in Unix? [closed]

I wanted to save mail in unix in some directory, as we do in outlook (files are saved with .msg extensions). Is there any workaround for doing this.
3
votes
3answers
214 views

Standard and portable way to send email from console?

What is the most portable or standard way to send an email from the console or a script on Linux, and possibly Unix?
1
vote
1answer
269 views

Email file attachment from command line

I want to email the file returned by the following command as an attachment (on RHEL/CentOS): ls -1 $(hostname -s)*.xml | tail -n 1 For example, the command above returns server-20140430080511.xml ...
5
votes
3answers
248 views

How to grab the oldest unread message from `mail` in a script?

In a script I am trying to finish writing now, I need to get the oldest unread message from the current user's mailbox (specifically, I need the subject line for this project). After extracting the ...
2
votes
1answer
1k views

Block local (unix) users from sending mail

Is there a way to block a local/unix user (or a list of local users) from sending mails via mail command (or maybe even in postfix, which is the MTA I have).
2
votes
1answer
698 views

How do postfix and mailx interact with mbox locking?

If postfix is setup as the MTA using its virtual transport to deliver mail to a local mbox file (and handling delivery of outgoing messages), and mailx is the MUA, being used on that same computer for ...
5
votes
3answers
5k views

RHEL - Uuencode + mailx = gibberish

I understand uuencode is for encoding files, and mailx sends mail. However, I'm not exactly understanding... Why uuencode file file | mailx -s "subject" email_adress keeps sending messages with the ...
3
votes
3answers
7k views

Mail command to send attachements

I tried the below command uuencode data.txt | mailx –s “Test Mail” “mrp@xyz.com” But I get the below error ksh: uuencode: not found. Null Message body; hope that' ok which clearly tell that ...
1
vote
1answer
2k views

Maildir and mailutils?

I want to use the mailutils app on a install of Ubuntu 12.04.3 LTS with a Maildir format, but every time I run the mail command, the system looks in /var/mail/user, instead of the Maildir directory in ...
2
votes
2answers
773 views

Where do uncaught local emails go?

Suppose I run - mail goldfish There is no such account on the system and no such aliases defined, where would the mail go? How do I see a list of such mails?
0
votes
0answers
2k views

How to set up smtp and send emails?

I'm new to raspberry pi. I installed the raspian OS on it. I want to send emails from it using my gmail account. I want to send from the command line interface and from php scripts. I followed this ...
0
votes
1answer
34 views

Weird logging behavior in Berkeley mail on a Mac

I use Berkeley mail (/usr/bin/mail) on an iMac. It has just started behaving in strange ways. If I type "~v", to open an editor, I get "[LogLevel VERBOSE]" or sometimes "[LogLevel DEBUG]" and the ...
2
votes
1answer
924 views

How do I track down the source of a ssh login message?

I installed mailutils on my linux machine with Linux Mint 15 (basically Ubuntu 13.04). When I log in, I get the following: Welcome to Linux Mint 15 Olivia (GNU/Linux 3.8.0-32-generic i686) Welcome ...
6
votes
1answer
3k views

How can I bcc with mailx?

I'm trying to send unix mail (heirloom-mailx) via bcc. $ mail -V 12.5 6/20/10 My MTA is exim, which sends via Gmail SMTP. I can execute the following: echo -e "body" | mail -s 'subject' -b ...
7
votes
2answers
5k views

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?
4
votes
1answer
2k views

mail doesn't work [duplicate]

I'm new to GNU/Linux and I want to send e-mail to other users on my computer (specifically from root to david). I've searched on google and I have tried the following: # mail david Subject: ...
4
votes
1answer
1k views

How can I set an e-mail's headers using /usr/bin/mail?

I have a bunch of scripts on an IBM AIX server's crontab that call the mail command to send myself an e-mail, kinda like this: $ mail -r myon@hakugyokuro.gk -s "Results for `hostname`" ...
3
votes
3answers
846 views

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?
3
votes
3answers
4k views

set up local mail delivery to user from cron script

A line in my cron.daily script not work as expected. I haven't any special smtp mail server in system, this line rsync -avun --inplace /oneuser/file.xls /otheruser/file.xls| mail -s "$0 $?" ...
1
vote
1answer
893 views

Sending Emails from bash script in Solaris VM

I am trying to send emails using the following bash script: /bin/mail -s "#subject" "$emailto" < "$message" It works fine on my local machine but does not work on my VM. I looked it up and read ...
6
votes
3answers
9k views

How to delete a range of mails in Solaris using the 'mail' command?

I have some 1k+ mails in an inbox (old cronjob stdout), how to delete them in bulk? I'm on Solaris 8 and I have only mail available, no pine or mutt or similar "UI"-based client. Inline help and ...