Mail command not working in Linux
mail
is a mail user agent (MUA), you also need a mail tranport agent (MTA), such as postfix
, to deliver non-local mail. The MTA has to be configured appropriately, many ISPs require that mail be routed through their mail servers. This usually means configuring your MTA to treat theirs as smarthosts or relays rather than attempting to deliver mail directly to the mailserver for the recipient's domain.
Have you checked your MTA configuration and checked your logfiles for messages about delivery failures.
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
I have questions about mail,
I am using following command on my linux account of my compnay
mail -s 'Hi' [email protected]
But I dont receive any emails, where as did not receive any error while executing the above command, so whats going on and what is happening.
- what email id do mail use to send the email by default. Is there any way or command to print this by default user id.
-
chown almost 13 yearsCan you include the contents of (or last 5-10 lines of) the
/var/log/maillog
file please? -
chown almost 13 yearsAlso, please run
mailq
and show the output of that command. -
Admin almost 13 years@chown Ok. I was using Ctrl-D. But now I tried using '.' but still it doesnt work.
-
Admin almost 13 years@chown: Output mailq; can not chdir(/var/spool/mqueue/): Permission denied Program mode requires special privileges, e.g., root or TrustedUser.
-
Admin almost 13 yearsIs there any way I could become TrustedUser other than root.
-
chown almost 13 yearsrun:
sudo mailq
orsudo su -
thenmailq
. Also, do you havemailx
installed? -
chown almost 13 yearsOr you could
chmod 755 /var/spool/mqueue
. But in order to do that, you would need to be root or sudo'd.
-
mosiac almost 12 yearsI just stumbled on this because I'm having a similar problem but my e-mails are hanging while using your 3rd option with the < /path/to/file.txt addition to the mail command. If I use control+d or a period they do go through. I even put a lone period in the text file i'm using to see if that work work. And I'm stuck.