LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sendmail not including subject when sending (https://www.linuxquestions.org/questions/linux-software-2/sendmail-not-including-subject-when-sending-4175717489/)

tonj 10-06-2022 10:28 AM

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.

bathory 10-07-2022 10:52 AM

Quote:

Originally Posted by tonj (Post 6384697)
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.

Use mail instead of sendmail.

Regards

elgrandeperro 10-07-2022 11:53 AM

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.

chrism01 10-10-2022 12:25 AM

I agree that calling the SMTP daemon direct is ... odd.
Use mailx instead.

xlfs-0.2 10-22-2022 05:57 PM

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 :)

xlfs-0.2 10-22-2022 06:00 PM

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.

tonj 10-23-2022 10:37 AM

@bathory thankyou your suggestion worked


All times are GMT -5. The time now is 01:18 PM.