Questions tagged [mail-command]

The mail, Mail and mailx command line utilities

Filter by
Sorted by
Tagged with
1
vote
1answer
36 views

Override hostname for mail(1) in a shell script

I'm trying to quickly send some stuff to myself from my MacBook, but I'm having issues with my server rejecting the SMTP connection due to the unqualified domain name in the from field. I've tried ...
0
votes
1answer
1k views

sending alerts from linux machine through email to MS outlook exchange

I Have a Scenario. I have written a shell script who check the space of mount point '/u06'. if free space is greater then 20% then its OK or if free space is less then 20% then it should generate a ...
0
votes
1answer
31 views

How to use emojis on the subject line of mail?

I am writing a shell script to setup a few servers and once it is done, it will send an email to our help desk letting us know that the server is ready to be used. I would like to use the following ...
1
vote
0answers
25 views

mail command sends empty body if file attached

Whenever I attach a file to mail like: $ mail -A attachment.pdf -s"Subject" id@domain.com Cc: This body never gets sent. And hit Ctrl+d to send the mail. The attachment and the subject get sent, but ...
5
votes
1answer
4k views

HTML email from heirloom mailx on linux

I've been trying to work through sending a html email from mailx on a linux server. Few Notes: I have to specify a smtp server so therefore I cannot use sendmail (This is not something I can change ...
1
vote
0answers
34 views

18.04.1-Ubuntu: Mail command unable to set mail body with attachment

I am trying to use mail command to send 2 attachments. The issue which i am facing is unable to send attachment and mail body content. tried following command echo "Hello World" | mail -s 'Test Email'...
1
vote
0answers
136 views

How to monitor system with `snort` and send emails about `alerts`

PROBLEM: I have been configuring snort on my systems and would like to get emails from the systems if there are any alerts. What I have tried is swatch but I can't find much documentation on it, can ...
0
votes
1answer
40 views

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 ...
99
votes
4answers
149k views

What is “mail”, and how is it navigated?

The program is located in /usr/bin/mail. Upon execution, Version 8.1.2 01/15/2001 is shown. Entering list produces: Commands are: next, alias, print, type, Type, Print, visual, top, touch, preserve,...
1
vote
2answers
2k views

How to send mails using SMTP server in Linux without error

I'm trying to send mail via SMTP server. And set /etc/mail.rc file with: set bsdcompat set smtp=smtps://smtp.gmail.com:465 set smtp-auth=login set smtp-auth-user=user@gmail.com set smtp-auth-password=...
0
votes
1answer
810 views

mutt is changing the content in body

I have a text file with multiple lines in content . But when I am sending it in mail all the lines are coming in one line in email as part of body of mail. But when I insert empty line in content ...
2
votes
3answers
2k views

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 ...
1
vote
1answer
3k views

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

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, as well as that user to ...
2
votes
2answers
130 views

Create a script to check the date, time and string and trigger a mail

Need to create a script where I want to take the last few lines of the log file and check that the last line with Start Date contains the date of today and the time 17:00:xx and is followed by xxxxx ...
0
votes
1answer
77 views

Sending two text files with mail command - No -a support [duplicate]

I searched but did not find this answer. I am running an old RedHat 5.3 system on one server (working on upgrade to 7 in progress) but I want to send 2 text files using the mail command. I do this all ...
1
vote
2answers
387 views

Ways to add recipients in mailx

What options do I have for adding recipients to email when using mailx (or variations thereof)? The ones I know about are: Manually type email address character by character from memory Enter an ...
0
votes
1answer
644 views

Perl script to format .xls file in Linux [closed]

All I have is a linux command (I don't know what's behind the command, the script or what formats the command output), so what I can do is to pull the data [which is in table form with invisible ...
5
votes
1answer
2k 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 /usr/local/bin/...
0
votes
1answer
347 views

-c and -b options not working in mailx in ubuntu

I was trying to send a mail from the shell script using the command mailx -s "TEST MAIL" -c "user_name ..." user<message.txt but it generates an error as unrecognized option -c ,the same happens ...
1
vote
0answers
2k views

How to check whether I can send mail from my Linux server?

When I tried using mail or mailx with -r -s -a and other options, I am not able to send mail. Is there anything I need to check before sending mail from Linux server? When I tried to see help for ...
1
vote
1answer
143 views

Does /usr/bin/mail have a queue?

RHEL 5 I'm using a perl service monitoring script (written by a colleague that is no longer with the company) running on an old RHEL 5 box. If a service is down, it sends an email alert to the root ...
0
votes
0answers
350 views

usr/lib/sendmail doesn't work

On one of our company server, suddenly /usr/lib/sendmail stopped working. We have a call to it in few scripts (owned and ran by oracle user) and none of them is able to send an email out, even ...
7
votes
2answers
11k 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 hidden1@...
0
votes
1answer
25 views

how to send lines/messages to maillog file [closed]

under /var/log , we can see the following maillog files -rw------- 1 root root 11733421 Aug 5 03:47 maillog-20180805 -rw------- 1 root root 15566137 Aug 13 03:16 maillog-...
0
votes
0answers
615 views

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 ...
8
votes
3answers
15k views

Delete a range of email messages using the 'mail' command

I have about 1k+ mails in an inbox (old cronjob stdout). How do I 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 ...
1
vote
1answer
32 views

How to retain retain et. al. in mail(x)

When entering personal preferences like retain me@example.com inside command line mail, how can I have these saved so they are reloaded the next time I start mail?
0
votes
1answer
813 views

How to receive new email?

mail -f /home/debian9/Maildir When new email coming,how to receive it in mailutils interface? There are 1 email in my /home/debian9/Maildir. Sent an email from admin to debian9 with command: echo "...
1
vote
1answer
4k 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
3answers
27k views

Set sender name in mail function

How can I set sender name and email address using mail command in shell script.
5
votes
3answers
7k 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. ...
13
votes
1answer
9k views

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 ...
1
vote
1answer
45 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
2answers
1k views

sendmail with html and file content

I need to send contents of a file in an email and add some html note at the beginning and ending of the file. I have used "sendmail" for the purpose, however when I receive the email I do not see the ...
1
vote
0answers
35 views

Cause Code Not Implemented for Heirloom-Mailx

I am attempting to send an message with an attachment from my RP3 to my phone, which uses Sprint. I have Exim4 setup as a MTA and the Heirloom-MailX configured so I can send an attachment. I am using ...
2
votes
2answers
462 views

How to get response from mail command

I am trying to send the send email using the mail command as mail -s "subject" email_address < email_text but how will I confirm whether email is actually sent or not ( i.e. email_address is ...
0
votes
1answer
486 views

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
vote
1answer
611 views

Can't send mail via sendmail

I'm trying send mail via sendmail, but mail is not received. Here is the command: /bin/cat /scripts/zabbix/test.txt | mail -v -s "Blocked IPs" example@example.com Here is the output example@example....
0
votes
1answer
708 views

Send raw message with mailx command

How can I pass a full raw/MIME message (raw file) to the Linux mailx command for delivery? I don't want to extract the recipient, subject, body etc from the message - I want to feed a complete ...
6
votes
3answers
21k views

Setting headers using the /bin/mail command

I have a bash script that I use with nagios that sends notifications by email. The key part of it looks like this: # $1 (FROM) | $2 (TO) | $3 (SUBJECT) | $4 (BODY) /usr/bin/printf "%b" "$4" | /bin/...
1
vote
1answer
8k 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. ...
1
vote
1answer
92 views

Local mail delivery affected by method of root login

I just sent a local mail using the following syntax: echo "Testing" | mail -s "This is just a test" root@localhost Then I log into root using: sudo -i And check my mail. The message is there. If I ...
1
vote
1answer
331 views

Trouble sending email from the mail utility in Bash

I used the following command to send an email echo "Body of the mail" | mail -s "subject" "something@gmail.com" The first time I ran it, it returned an error saying the program mail is not installed....
1
vote
0answers
303 views

mail/mailx: How to specify recipents with full names?

Rich email clients allow users to be identified likewise: John Smith <jsmith@example.com> How can I use such format for recipients (or other email fields for that matter) with mail and/or ...
3
votes
2answers
1k views

Can not use mail command

error like this: [user1@fedora ~]$ mail No mail for user1 but that is appear Maildir(mailbox) in /home/user1.
4
votes
1answer
20k views

Shell script hangs on mail command

I'm finding that a call to the mail command is causing a script to suspend without error. To close the script I have to ctrl-c or issue a kill command on the process id. The pertinent section of ...
-1
votes
1answer
704 views

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

Mail vs. mail what is the difference

What is this business about mail and Mail? [On a CentOS box] Why mail does not work but won't return an error either while Mail works fine with the exact same syntax? Mail is basically a link to mail,...
4
votes
4answers
2k 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 don't want to forward the mail, I ...
4
votes
1answer
7k views

How can I automatically forward system mail?

I have a system job that fails and sensd me mail that I can read with the mail command. That means I still need to login to the mail server to get the emails and read them. The server supports sending ...