First of all, the lines you are truly interested in are:
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
These errors have been reported several times by Debian and Ubuntu users (you can actually Google them for more information). It seems like the PATH variable isn't ...
Behold the confusing history of mail, nail, mailx.
Briefly, mail is the older program, mailx (formerly nail in some implementations) is a newer version , with an extended mostly-but-not-totally-compatible interface.
mailx is still quite old, created around 1986 and standarized as part of POSIX in 1992. There are several implementations (even in modern ...
To print the first mail message in your default mailbox, use:
echo p | mail
mail is only interactive when stdin is a terminal. Because mail gets its stdin from a pipe, it is non-interactive. The p command (print) tells it to print the default (first) message.
For more options, you may find that man mail is very helpful.
Just change | (a pipe) to || (an or) (assuming the script uses exit codes properly) though changing the script to only output on error and doing this is better practice:
20 6-10 * * 1-5 ~/job_failure_test.sh
The ugly way;
20 6-10 * * 1-5 ~/job_failure_test.sh > ~/job_fail.log 2>&1 || ...
The formail tool from procmail (available in any distribution, it's a classic) is designed precisely for this purpose.
formail -s myprogram --option
runs myprogram --option on each mail in turn. The program receives each mail on its standard input.
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
# more /var/log/maillog
Sep 1 17:07:50 izuf6cj2o216xp postfix/sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
#inet_interfaces = localhost
inet_interfaces = all
service postfix start
heirloom-mailx hardcodes the options to pass to /usr/sbin/sendmail, and unfortunately the ones it passes don't make Bcc: headers work right in exim. That isn't really fixable, without patching and recompiling it. (You need to have it add -t to the arguments, and then either not pass the list of email addresses or alternatively set ...
Email was designed back when computers did not have a permanent, fast network connection to each other, on the model of postal mail. When you send an email, it gets sent to a server, which sends it to another server, and so on until the email reaches its destination. The oldest mail systems had local delivery, then there were systems where the email had to ...
This feature is built into cron! If the command produces any output, or if it returns a nonzero status, then cron sends you an email.
Many modern distributions don't set up local email. If your doesn't, install a mail transfer agent (MTA). See e.g. this thread for Ubuntu, or Minimal MTA that delivers mail locally (for cron)? if you absolutely want something ...
If using GNU mailx from mailutils package, BCC and CC can be added by using the --append option to add header variables, like so:
$ echo -e "body text line1\nline2\n\nsent at: $(date)" | mailx --append='FROM:Foghorn Leghorn <email@example.com>' --append='BCC:firstname.lastname@example.org' -s "test subject" -- email@example.com firstname.lastname@example.org minnie@...
somehow I had the same problem.
Please read your error message carefully and you will find the solution.
There is a note that says:
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin
Then I checked my path and somehow I was missing the /sbin in my path.
then I added and the problem was gone. :)
The man page for mailx says that the DEAD environment variable can be used to override the dead.letter file. Set it to /dev/null and you should get no more dead letters
export DEAD=/dev/null # sh, bash, ksh, ...
setenv DEAD /dev/null # csh, tcsh
Debian and Ubuntu have replaced Heirloom mailx with s-nail mailx. Both support that option. But there are several other mailx commands from other packages which do not, including the GNU Mailutils mailx which you have apparently unknowingly switched to.
On the gripping hand, as Fabby said, do not pass user credentials around in command arguments (or ...
You can change the location of the mailbox in two ways. The first is using the MAIL environment variable:
The other method is to use the -f option to mailx to specify a mbox file manually:
mailx -f ~/Mailbox
You can do it with mutt like this:
mutt -a $(find . -type f -name "sum*")
If you want to do it non-interactive, try
mutt -s "Subject" -a $(find . -type f -name "sum*") -- email@example.com < /dev/null
If mutt is not installed, here is an example with mail and more tools (e.g. mpack)!
So it should be something like
# This needs heirloom-...
With most mailers you can do something like this in the /etc/aliases file.
joe: joe, firstname.lastname@example.org
After making changes to this file you typically have to run the command, newaliases.
How to redirect local root mail to an external email address on Linux
Forwarding email and must keep a copy
According to heirloom mailx's documentation:
resend: Takes a list of messages and a user name and sends each message to the named user. 'Resent-From:' and related header fields are prepended to the new copy of the message.
For a bare-bones way to achieve the same effect, you don't even need to use an MUA at all. You can just use the shell and pipes to ...
Your original command will work if you have the heirloom-mailx package installed.
sudo apt-get install heirloom-mailx
Then you can:
mailx -s "Test" -a /home/user/filename.xlsx email@example.com < /root/emailbody.txt
From RFC 2822 para 3.6.2:
When the "Reply-To:" field is present, it indicates the mailbox(es) to
which the author of the message suggests that replies be sent. In the
absence of the "Reply-To:" field, replies SHOULD by default be sent to
the mailbox(es) specified in the "From:" field unless otherwise
specified by the person composing the reply.
The lack of description in the question makes it hard to pinpoint the exact problem in this situation, but I recently faced the same issue:
root@debian:/home/user/Downloads# dpkg -i [Some package]
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
It sounds like you want Exim's address rewriting.
In the rewriting section of your Exim config file, you will probably want something along the lines of this:
firstname.lastname@example.org email@example.com Ffr
You may need to adjust the flags ("Ffr") to the specific behavior you want.
More generally, see:
You can get the "Thomas<firstname.lastname@example.org>" when you use sendmail directly. That is not so complicated, you just need to create the header
To: Thomas <email@example.com>
Subject: The content of my home directory
<output from ls>
There has to be an empty line between the header and the content. You can achieve ...
Traditional mailx does not support IMAP or POP, but the one that comes with Linux does.
For your particular problem, I recommend using fetchmail instead. You can use the --mda option to have fetchmail execute a script of your choice for each downloaded message. It can even pass the From and To addresses as parameters to your script if you use %F and %T as ...
You are right, Postfix will lock the mail file during delivery.
The mailbox is locked for exclusive access while delivery is in progress.
Read more about it here
But that doesnt mean that your other incoming mails will bounce. If postfix cant deliver during a try,
Apr 15 14:02:25 server.tld postfix/local: D8C46C9014D: to=, relay=local, delay=1956,...
If you don't mind everyone seeing everyone else's address on the list (which I'm sure is acceptable, given you're emailing the list to everyone), this would do it
mailx -s "subject" $(cat filename) < filename
The -b option, to specify addresses on the command line, does not appear to be supported on your version.
Your second, interactive example works because mailx recognises it as tilde escape. These have to appear as the first thing on the line in the message body, rather than on the command line. They're in the specification, so they are more widely ...
mailx only sends mail if you pass it the destination address on the command line. When you run it with no arguments, it reads interactive commands from its standard input. Beware that your tests fed it garbage which has been interpreted as commands; some of these commands may have corrupted your mailboxes, sent out emails, etc.
Tell mailx to run mailx -t, ...
According to Arch Wiki mailx forks and systemd kills the main process when script exits. Looks like adding -v to mailx call prevents it from forking, but more correct way to make it work with systemd is to add -Ssendwait to mailx's arguments.
Mailx is just a command-line tool to pass mail to your Mail Transfer Agent (MTA; whatever it is you have installed: sendmail, exim, ...). It does this by invoking the command sendmail (usually /usr/sbin/sendmail). Your MTA provides this command to, well, send mail.
In your case, it tries to contact a server on the IPv6 address of the loopback device on ...