LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2017, 01:07 PM   #1
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Rep: Reputation: Disabled
Transition from UNIX to Linux and in sendmail purgatory


Good afternoon,

New to Linux (since Monday) and have encountered a few things with sendmail that need some solutions to.

Bit of background. We took our same sendmail construct from UNIX in LINUX. Basic code structure is as follows
------------
mpack -s "Morning Report" -d <report text body> -o <report tempfile> morningspreadsheet.xls

/usr/sbin/sendmail -f <sender address> <recipient address> < <report tempfile>
-------------

It will send the email but we have noticed the following

1.) the "To" tag is currently always blank
2.) the "From" does not show a from name but it shows the name of the process that is running with the recipient address. For example "root (personwhoworkshere@thiscompany.com)" instead of "My Name (personwhoworkshere@thiscompany.com)"

Is there any means of working with the current options to get the "To" tag to show and fix the name of the "From"? So far we have deduced that we will have to create a text with this information in it in order to do. However, if there is a way to do this without having to update a few hundred text files that would be great.

Thanks!

RIP
 
Old 03-28-2017, 04:41 PM   #2
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 999

Rep: Reputation: 164Reputation: 164
sendmail should behave the same in Linux as it does in Unix: the source is the same.

The sendmail command you specify doesn't set a recipient in the header; use the -t switch.
Use the -F switch to set the sender's 'full name'. Different e-mail clients show different 'from' for the same message. Different recipients are seeing it differently.

Perhaps you have a different sendmail.cf - though I don't know what differences would cause the difference you report.
 
Old 03-28-2017, 05:07 PM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,291

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Welcome to Linux and LQ,

You should specify your distro, so we could help you better. Depending on distro, if sendmail is not installed, the sendmail command is linked to a compatibility binary of the installed smtp server s/w (like postfix, qmail, exim etc).
So while for the real sendmail, the -f switch is correct and it should work in your example, in the compatibility binaries it may not work.

That said, you can use mutt, or mail/mailx to do your job. E.g:
Code:
EMAIL=<sender address> mutt -s "Morning Report" <recipient address> < <report tempfile>
Regards
 
Old 03-28-2017, 05:58 PM   #4
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by RandomTroll View Post
sendmail should behave the same in Linux as it does in Unix: the source is the same.

The sendmail command you specify doesn't set a recipient in the header; use the -t switch.
Use the -F switch to set the sender's 'full name'. Different e-mail clients show different 'from' for the same message. Different recipients are seeing it differently.

Perhaps you have a different sendmail.cf - though I don't know what differences would cause the difference you report.
Thank you for your response. Perhaps I am not reading the man page correctly but the -t options reads like it will pull the "to:" from a file. With the sendmail we did not have that in the text since we could include it as an option. We are trying to not have to update each of the files to include the "From:" and "To:" information if possible.
 
Old 03-28-2017, 06:00 PM   #5
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Welcome to Linux and LQ,

You should specify your distro, so we could help you better. Depending on distro, if sendmail is not installed, the sendmail command is linked to a compatibility binary of the installed smtp server s/w (like postfix, qmail, exim etc).
So while for the real sendmail, the -f switch is correct and it should work in your example, in the compatibility binaries it may not work.

That said, you can use mutt, or mail/mailx to do your job. E.g:
Code:
EMAIL=<sender address> mutt -s "Morning Report" <recipient address> < <report tempfile>
Regards
Question, for using mail/mailx. I thought you would have to have a file with the To and From in order to use the option that would extract them. Is that not the case?
 
Old 03-28-2017, 11:06 PM   #6
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 999

Rep: Reputation: 164Reputation: 164
Whoops! You have read the man page correctly. I set up programs to do this automatically years ago and forgot what the -t switch does. Sorry.

I use echo to prepend recipients and subject to a dummy file, concatenate the message to that dummy file, then send it with -t.
For example:
Code:
echo -e "from:  scientist@entomology.com\nto:  Banana@fruit.com \nsubject:  Fruit flies\n\n" > DummyFile
cat TextOfMessage >> DummyFile
sendmail -t < DummyFile
rm DummyFile
Mr/Ms Bathory makes a valuable observation that other SMTP servers partially-emulate sendmail, that you may not have sendmail on your new system.

Last edited by RandomTroll; 03-28-2017 at 11:30 PM.
 
Old 03-29-2017, 03:02 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,291

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Quote:
Originally Posted by rip73 View Post
Question, for using mail/mailx. I thought you would have to have a file with the To and From in order to use the option that would extract them. Is that not the case?
Nope. You can give the From address at command line.
But again it depends on distro, that's why I've asked you to tells us the Linux distribution you're running.
Anyway if you don't want to use mutt as in my example above, read the manpage of mail/nail/mailx (whatever your distro uses) to find the correct options.

Regards
 
Old 03-30-2017, 03:33 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,559

Rep: Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424
I agree with Bathory, tell us your distro.
A lot of modern distros have moved on eg RHEL derived systems have moved on to postfix.
Even if if you then install sendmail, it might not actually be what's running.
 
Old 03-30-2017, 01:58 PM   #9
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
i agree with bathory, tell us your distro.
A lot of modern distros have moved on eg rhel derived systems have moved on to postfix.
Even if if you then install sendmail, it might not actually be what's running.
rhel 7
 
Old 03-30-2017, 02:25 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,291

Rep: Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697Reputation: 1697
Quote:
Originally Posted by rip73 View Post
rhel 7
So what gives:
Quote:
ls -l /etc/alternatives/mta
Did you consider using mutt for your task?
 
Old 03-30-2017, 02:27 PM   #11
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
So what gives:

Did you consider using mutt for your task?
We are open at this point but we were trying to not have to rewrite a bunch of programs if we do not have to. Is there something with RHEL 7 and sendmail not being compatible? Is there something with postfix that would help to keep using sendmail?
 
Old 03-30-2017, 02:34 PM   #12
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 999

Rep: Reputation: 164Reputation: 164
There's no reason you can't install sendmail. I customize sendmail.mc so I build my own. It's not onerous.
 
Old 03-30-2017, 03:08 PM   #13
rip73
LQ Newbie
 
Registered: Mar 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by RandomTroll View Post
There's no reason you can't install sendmail. I customize sendmail.mc so I build my own. It's not onerous.
We have sendmail installed but it seems to not work consistently. Sometimes not at all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
transition from windows to linux ssaia Linux - Newbie 7 02-07-2013 02:30 PM
[SOLVED] Unable to use sendmail utility in UNIX environment sdiptanil Linux - Newbie 1 06-28-2010 01:18 PM
help me out here on DOS to Linux transition with C zhyjanet Programming 3 03-25-2005 09:16 AM
My Transition to Linux Plan. rvijay Linux - Newbie 7 08-24-2003 11:12 PM
Unix/Perl/Sendmail behaving strangely! stephbock Linux - General 6 01-21-2003 04:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration