sendmail not including subject when sending
I have a raspberry pi server with sendmail installed and I have /root/.bashrc configured to automatically send an email when anyone logs in.
/root/.bashrc contains this line: echo 'ALERT - Root Shell <server-hostname> on:' `date` `who` | sendmail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" <my-email@address> when I log into the server the terminal throws this error: Alert:... List:; syntax illegal for recipient addresses but the email still sends. however when I get the email the message body is fine and contains the correct info but there is no subject line. I can't figure out where the error is. the strange thing is I have exactly the same command in a centos 7 machine and that works fine. thanks for any advice. |
Quote:
Regards |
I think must people use mailx or mutt to send command line mail. In fact sendmail is a daemon, but I think it inspects the called name to do different functions. So I am surprised it works because my sendmail doesn't have a -s option at all.
|
I agree that calling the SMTP daemon direct is ... odd.
Use mailx instead. |
You have the syntax wrong :) Shouldn't be too hard for you to learn once you decide you don't know the syntax and look for the right syntax :)
|
Some mail programs (ie in old debian) had known viruses in them - hooks that allowed remote computers to break in. I'm not saying sendmail is perfect. But I will say "don't pick a mailer that is overyly complex from a major distro" since you might not understand the entirety of what it does. Instead pick one that is simple and clean. Google around for complaints about the mailer. Make sure you can FIND complaints that big tech doesn't have control over "removing from sight". If you are looking for complaints about an ubuntu mailer in ubuntu forums: my advice is stay away. They delete complaints.
|
@bathory thankyou your suggestion worked
|
All times are GMT -5. The time now is 01:18 PM. |