Questions tagged [mail-command]

The mail, Mail and mailx command line utilities

Filter by
Sorted by
Tagged with
0
votes
1answer
26 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 ...
1
vote
0answers
29 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
106 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
35 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 ...
2
votes
2answers
96 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
67 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 ...
0
votes
1answer
313 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 ...
0
votes
0answers
315 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 ...
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
573 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 ...
1
vote
1answer
138 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 ...
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=...
1
vote
2answers
369 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 ...
1
vote
1answer
30 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
705 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 "...
0
votes
1answer
753 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
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
440 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
468 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
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 ...
5
votes
1answer
3k 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 ...
0
votes
1answer
696 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 ...
1
vote
1answer
90 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 ...
0
votes
1answer
621 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 ...
1
vote
1answer
327 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
297 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 ...
1
vote
1answer
602 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....
1
vote
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 ...
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
votes
1answer
698 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?
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 ...
3
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 ...
3
votes
1answer
3k views

What should I configure to send mail on the command line?

I am working in the computer at home I want to send me an email and I tried: uuencode all.sh all.sh | mail mymail@gmail.com But the problem is that nothing arrive to my email, I just get the ...
0
votes
1answer
475 views

SSMTP - Can send E-Mail via CLI - But Programs fail to send notifications

Today I set up a new XYMon monitor VM. The old one used PostFix, but I set up SSMTP. I can e-mail myself fine from the CLI like such. echo "Hello, World" | mail -s "My email check" my@email.com But ...
1
vote
2answers
63 views

Mail one liner to check if null before sending [duplicate]

I'm trying to modify a script which emails a user group the contents of a directory. The modification I'm looking for is to check the script below to see if it has valid output before sending. The ...
0
votes
1answer
248 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
513 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 ...
4
votes
1answer
836 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
101 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" or ...
2
votes
1answer
39 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
134 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
636 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
120 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 ...
8
votes
3answers
2k 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" | ...
1
vote
1answer
391 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
3k 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.. ...
4
votes
4answers
1k 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 ...
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. ...