Questions tagged [mail-command]

The mail, Mail and mailx command line utilities

Filter by
Sorted by
Tagged with
0 votes
1 answer
250 views

mail: unrecognized option '-S' | sending mail from linux server

I am trying to run a bash to send emails from my linux server. I am using the following command: echo "This is the message body" | mail -s "This is the subject line" -a "From: ...
user3165121's user avatar
0 votes
1 answer
328 views

How to make mail command to send email to root after installing msmtp?

Install a simple SMTP client: sudo apt install msmtp msmtp-mda Set in msmtprc :: cat .msmtprc account default host smtp.qq.com from [email protected] auth on tls on tls_certcheck off user [email protected] ...
showkey's user avatar
  • 333
0 votes
1 answer
197 views

Script to send an alert mail once the disk space is above 90% sends disk full even when the disk isn't full, how to resolve this issue?

#!/bin/bash df -m > myfile server_ip_address=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) if awk '$2 &...
achhainsan's user avatar
0 votes
0 answers
494 views

timed out while receiving the initial server greeting

I'm trying to host a postfix mail server.I have a box with a fixed IP and also a mx record and spf record that link my box IP to my dns record. I can telnet to alt4.gmail-smtp-in.l.google.com 25 but ...
I_md_ou's user avatar
4 votes
1 answer
111 views

Where are these "extra" RCPT_TO lines coming from when I send an email via SSMTP?

I've been using SSTMP on a local FreeBSD machine to send stuff like the output of certain cron jobs to my "real" main email account, which is not hosted on the same machine (or even domain). ...
Bob Vesterman's user avatar
0 votes
1 answer
176 views

How to print the entire contents of a sent mail for debug purposes?

I try to see the raw data of a mail that I sent with mail -s "My Subject" [email protected]. Is it possible, if so, how? Expected output is similar to: From: "root" <root@example....
Martin Braun's user avatar
0 votes
0 answers
22 views

mail sent in encoded format without any attachments

I am trying to migrate a certain script from AIX to Linux and having issues with the mail functionality. The rest of the script works fine, but the mail function is sending encoded mails with no ...
Preeti Maurya's user avatar
3 votes
1 answer
3k views

How can I make GNU mailutils to use an external SMTP server?

Does anybody on this planet know what the equivalent GNU mailutils command to the following looks like? Is this even possible without a local MTA with mailutils? Using s-nail it works as intended. s-...
Booker B's user avatar
0 votes
0 answers
647 views

Cannot get shell script to send error message as mail body

I have a shell script I want to email me when a particular command fails and send along the error message. Either it doesn't send an email at all, or it sends an email with an attachment named ...
Chanel's user avatar
  • 99
1 vote
1 answer
485 views

mail command sends body as attachment, unlike normal email client? How to stop this?

I am using the mail command from mailutils on Ubuntu Linux 20.04. I am using it to send documents automatically to a service on the web which processes them. They provide an email address to which you ...
crobar's user avatar
  • 223
0 votes
1 answer
71 views

'If' statement breaking his own rule or I'm doing so

Explanation: I'm playing a little bit with a script this one helps notifying to user about SSL certificate expiration. If certificate has less than 30 days to expires, this will notify to user, if isn'...
Mauricio Reyes's user avatar
0 votes
1 answer
35 views

Increasing the width of messages listing in mail prompt

How to increase the width of listings in mail command prompt? Especially the message listing with the command h. The current listing is truncated at 80 characters as showing below: $ mail Mail [5.2 ...
Luciano's user avatar
  • 1,159
3 votes
2 answers
5k views

Configuring mail command to use msmtp

msmtp is successfully installed and works fine to send emails via an external SMTP server. However the mail command fails to send emails using GNU Mailutils on a Debian 10. for example echo "Test&...
JBC's user avatar
  • 61
1 vote
0 answers
369 views

SMTP Server Mail Alerts using TLS and authentication

i am a bit new in using SMTP server Alert configurations on AIX 7.1 OS . i am currently using below syntax which is running fine : mail -s "Subject" "[email protected]" < /path/to/my/...
Black Virus's user avatar
3 votes
2 answers
19k views

How do I find current users mailbox through shell (command line)

I am using ssh to login to a remote linux box on a capture the flag site, to trying to learn linux fundamentals, and one of the questions asks "What is the path to the htb-student's mail?". ...
Patrick-not-spongebob's user avatar
1 vote
1 answer
840 views

How do i set up local email delivery to send an email to my email address?

0 0 * * 6 /usr/sbin/chkrootkit 2>&1 | mail -s "chkrootkit Reports of my server" [email protected] I already navigated to the /usr/sbin directory and ran chkrootkit using sudo. That ...
Abdul Khan's user avatar
0 votes
1 answer
2k views

Configuring postfix in local machine in order to send mails

I am trying to automate a procedure and when a certain condition is met I would like to notify the user with an automated mail using the mail command. The thing is, that the messages are not being ...
ex1led's user avatar
  • 286
1 vote
1 answer
334 views

send mail manually by mail command

After installing mailutils on ubuntu 18.04 $sudo apt-get install mailutils I try to send email manually on CLI $mail -s test To: [email protected] Cc: then.... what should I do????
whitebear's user avatar
  • 175
2 votes
0 answers
487 views

msmtp with iCloud account doesn't work

I'm very new to Linux (Raspbian at Raspberry Pi 4 Model B) and I just try to send an e-mail via command line. Right now, this is working with msmtp and a gmx.de account following this guide. apt-get ...
PascalS's user avatar
  • 125
0 votes
1 answer
5k views

Mail command in linux

Want to send mail to my email id, but I'm not able to send. I have done sudo apt install mailutils. Here is my code: ssmtp [email protected] Hello world Showing error ssmtp :cannot open mail 25
Subir Makur's user avatar
0 votes
1 answer
2k views

Can I prevent postfix from sending to specific email addresses using the check_recipient_access postfix option?

I tried to block some email addresses from spammers, but this setup doesn't seem to have any effect: smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/bad_recipients, ...
Alexis Wilke's user avatar
  • 2,877
1 vote
1 answer
232 views

How to move/rename user mbox file with mailutils?

Is there a way to change the ~/mbox file where mailutils's mail program saves read mail and where mail -f reads from to something else, like ~/.mbox for example? I read that setting the MBOX ...
tdeary's user avatar
  • 11
0 votes
1 answer
308 views

How do I make .xls Or .pdf appear in body of email?

I know how to attach PDF or XLS file to email as an attachment using Unix commands. I would like to know how to send these reports to email body, so that users can access it quickly, instead of extra ...
Sudhakar Nelapati's user avatar
1 vote
1 answer
807 views

Mail recipient name with accents

Context $ echo $LANG fr_FR.UTF-8 Problem While it is possible to have accents in the sender name, mail seems to not accept them in recipient name: mail -s "Test" -r "Denis Bitouzé <denis....
Denis Bitouzé's user avatar
0 votes
1 answer
1k views

Why does mail create a dead.letter, but the mail still arrives

When I do this % mail -s "test" [email protected] < mail-text it takes a few seconds, then it comes back with this error message: /home/zach/dead.letter... Saved message in /home/zach/dead.letter ...
Gab's user avatar
  • 101
1 vote
1 answer
197 views

Mailing an html file

Is it possible to mail an html file that looks exactly like the second image? I know mutt -e 'set content_type="text/html"' -s "Subject" [email protected] < test.html works but it ...
Ykaly's user avatar
  • 73
1 vote
1 answer
802 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 ...
cnst's user avatar
  • 3,283
1 vote
1 answer
1k 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 ...
user avatar
2 votes
0 answers
271 views

mail command sends empty body if file attached

Whenever I attach a file to mail like: $ mail -A attachment.pdf -s"Subject" [email protected] Cc: This body never gets sent. And hit Ctrl+d to send the mail. The attachment and the subject get sent, but ...
Sourit Chakraborty's user avatar
3 votes
1 answer
1k 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'...
Murugan M's user avatar
1 vote
0 answers
2k 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 ...
somethingSomething's user avatar
0 votes
1 answer
120 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 ...
Vivek Kaul's user avatar
2 votes
2 answers
2k 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 ...
Aishwarya Mishra's user avatar
0 votes
1 answer
1k 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 ...
Scott Paterson's user avatar
1 vote
1 answer
3k 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 ...
LocalHost's user avatar
  • 489
0 votes
0 answers
2k 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 ...
FaMontyN2's user avatar
0 votes
1 answer
113 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-...
yael's user avatar
  • 13.1k
1 vote
0 answers
5k 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 ...
Necktwi's user avatar
  • 1,026
1 vote
1 answer
982 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 ...
Mike B's user avatar
  • 8,910
3 votes
2 answers
12k 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 [email protected] set smtp-auth-password=...
Parul Chourasia's user avatar
1 vote
2 answers
2k 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 ...
forthrin's user avatar
  • 2,289
1 vote
1 answer
72 views

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

When entering personal preferences like retain [email protected] inside command line mail, how can I have these saved so they are reloaded the next time I start mail?
forthrin's user avatar
  • 2,289
1 vote
2 answers
4k 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 "...
showkey's user avatar
  • 333
0 votes
1 answer
2k 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 ...
SuS's user avatar
  • 39
2 votes
2 answers
4k 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 ...
Kris Rav's user avatar
1 vote
0 answers
69 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 ...
nightmare637's user avatar
3 votes
2 answers
1k 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 ...
Ankur Khandelwal's user avatar
0 votes
1 answer
1k 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 [email protected] How can I do this?
the_velour_fog's user avatar
1 vote
0 answers
7k 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 ...
Radhakrishnan Rk's user avatar
7 votes
3 answers
12k 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 ...
FzZB03KCa46QeaU's user avatar