LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-06-2022, 10:28 AM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 546

Rep: Reputation: 37
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.
 
Old 10-07-2022, 10:52 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by tonj View Post
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
 
Old 10-07-2022, 11:53 AM   #3
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
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.

Last edited by elgrandeperro; 10-07-2022 at 12:00 PM.
 
Old 10-10-2022, 12:25 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I agree that calling the SMTP daemon direct is ... odd.
Use mailx instead.
 
Old 10-22-2022, 05:57 PM   #5
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 207

Rep: Reputation: 44
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
 
Old 10-22-2022, 06:00 PM   #6
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 207

Rep: Reputation: 44
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.
 
Old 10-23-2022, 10:37 AM   #7
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
@bathory thankyou your suggestion worked
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Subject: sendmail-8.17.1 DANE-function unresponsive, sendmail-8.16.0.41 OK talo Slackware 0 09-15-2021 11:44 AM
[SOLVED] Subject: support.sendmail.org said WRONG sendmail usage site.config.m4 line 2 talo Slackware 1 11-03-2018 05:23 AM
Sending mail with subject in Linux script 151803 Linux - General 5 01-25-2007 04:46 AM
sendmail (dont just ignore it 'cause its got sendmail in the subject :P) GnomeKing Linux - Networking 1 11-12-2001 09:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration