Sendmail not showing recipients

I've figured out to do a mail merge with /usr/lib/sendmail which is extremely helpful as it is lightning fast compared to an Outlook mail merge which pretty much locks up my machine while it struggles to push out the emails. I figured out how to send html emails, with dynamic variables, and how our company translates id's to addresses which is 95% done. The last obstacle I'm facing is that the emails do not show to whom the email was sent.

When I use Outlook mail merge, which does not have an option for Cc'ing multiple users, I have to put this pathetic note at the top saying "This email was also sent to <person1>, <person2>, <person3> (Outlook mail merge does not allow cc)". So I'm trying to use sendmail but it's now showing the recipients in the received mail so it doesn't achieve the desired result. This is how I have it set up:

while read line
doREQUEST_NUMBER=`echo $line | cut -d" " -f8`
USER_LOGIN=`echo $line | cut -d" " -f2`
END_USER=`echo $line | cut -d" " -f3`
REQUESTOR=`echo $line | cut -d" " -f4`
SERVER_OWNER=`echo $line | cut -d" " -f5`
(cat html_greeting
echo $END_USER
cat html_body
echo $REQUESTOR
cat html_server_owner
echo $SERVER_OWNER
cat html_closing
) | /usr/lib/sendmail -f NO-REPLY@domain $SERVER_OWNER,$REQUESTOR,$END_USER

done < txt

Where txt is a sheet of data w/ all the id's and stuff on each line. I tried putting the recipients without commas, inside quotes, with commas and inside quotes...several different combinations. The emails are sent and received but the three people will not see that they have all been send the email so there could be some confusion as to who is in the loop and who isn't. Is there a reason those three addresses would not show on the receiving email?

It looks like you can put the address into the email yourself and let sendmail pull them back out:

Man Page for sendmail (OpenSolaris Section 1m) - The UNIX and Linux Forums

-t Reads message for recipients. To:,Cc:, and Bcc: lines are scanned for people to send to. The Bcc: line is deleted before transmis- sion. Any addresses in the argument list is suppressed. The NoRe- cipientAction Processing Option can be used to change the behavior when no legal recipients are included in the message. sendmail is a very primitive mail client, so this is nice, nicer than feeding esmtp to tcp port 25 yourself.

1 Like

When you post problems, please post what Operating System and version you are using and what Shell you prefer.

If you have problems with a script like this, please post the command line used to invoke the script (blotting anything confidential with X's). Mail problems are difficult enough without so many unknown variables.

Quite honestly unless the variable "$line" contains some valid "sendmail" commands the whole script is guessware. As for what is in the file "txt" we remain uninformed.

I'm trying to be polite but please go away if you are trying to send spam. If you are a valid learner, please post a testable example without so many undefined variables or files with unknown contents.

@DGPickett
sendmail is a very primitive mail client . You are joking?

Pickett - thank you so much! I now have a couple of echo lines before it hits the body:

echo "To: $SERVER_OWNER"
echo "Cc: $ENDUSER, $REQUESTOR"

It works and now I can remove this pathetic line in the email: "This email was also sent to person1, person2, person3 (Outlook Mail Merge does not allow cc)" These emails will now look much more professional.

@methyl I'm not a spammer just someone who creates 40 - 70 accounts each day for a company and trying to streamline a process. I've asked several legitimate questions so I would appreciate it if you do not file accusations against me.

Apologies MaintdotC. It was the "-f NO-REPLY@domain" and the lack of information that made me question (not accuse).

Well, sendmail is very tricky in other modes, but as a mail sending client, it has no gui, does not receive, reply or forward, does not help you compose html email (and demands more effort if you do), does not support cc/bcc/ except by this obtuse and indirect way of embedding and then parsing back. Stuff that makes Mac people run screaming from the room. :smiley:

I wonder if Sendmail has a clause in its license that royalties should be paid if used in a business environment...

There are many versions, licenses, depending on where you get it, but I think it came from BSD, which can be had free to resell, unlike GNU, which is free to give away. You might look into learning esmtp and writing your own bytes to the mail server socket. Each layer, while different, just simplifies and restricts things a little.

None that I know of. You paid the licence when you paid the Operating System licence.

It always helps if you post what Operating System and version you are running.
I have no problem with the raw sendmail interface, but it have been known to use the outer fringes of the unix mailx command to deal with substantial CC and BCC lists. Though the manual may be hard to follow, the actual syntax of the command line and the mailing list files is quite simple.