Hot answers tagged

65

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 ...


17

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 ...


17

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.


10

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: MAILFROM=myemail@something.com MAILTO=myemail@something.com 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 || ...


10

The formail tool from procmail (available in any distribution, it's a classic) is designed precisely for this purpose. Basic usage: formail -s myprogram --option runs myprogram --option on each mail in turn. The program receives each mail on its standard input.


8

# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) # more /var/log/maillog Sep 1 17:07:50 izuf6cj2o216xp postfix/sendmail[25307]: fatal: parameter inet_interfaces: no local interface found for ::1 Solved it: vim /etc/postfix/main.cf #inet_interfaces = localhost inet_interfaces = all then service postfix start


7

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 ...


7

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 ...


7

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 ...


5

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 <fleghorn@sender-domain.com>' --append='BCC:recipient1@acme.com' -s "test subject" -- recipient@acme.com mickey@mouse.com minnie@...


5

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 and /sbin. Then I checked my path and somehow I was missing the /sbin in my path. echo $PATH then I added and the problem was gone. :) export PATH=...


5

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


5

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 ...


4

You can change the location of the mailbox in two ways. The first is using the MAIL environment variable: export MAIL=$HOME/Mailbox The other method is to use the -f option to mailx to specify a mbox file manually: mailx -f ~/Mailbox


4

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*") -- user@cats.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 #!/bin/bash # This needs heirloom-...


4

With most mailers you can do something like this in the /etc/aliases file. joe: joe, someaddress@someotherdomain.com After making changes to this file you typically have to run the command, newaliases. References How to redirect local root mail to an external email address on Linux Forwarding email and must keep a copy


4

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 ...


4

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 user@example.com < /root/emailbody.txt


3

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. ...


3

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: user@debian:su Password: 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 ...


3

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: pi@bar.com foo@bar.com Ffr You may need to adjust the flags ("Ffr") to the specific behavior you want. More generally, see: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-...


3

You can get the "Thomas<tmuller@gmail.com>" when you use sendmail directly. That is not so complicated, you just need to create the header From: fromaddress@domain.com To: Thomas <tmuller@gmail.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 ...


3

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 ...


3

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[67533]: D8C46C9014D: to=, relay=local, delay=1956,...


3

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


3

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 ...


3

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, ...


3

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.


3

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible