Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

sendmail

SOLVED
Go to solution

sendmail

Hi you all
I got the attached script from i do not remember where. In a way it works for "TO" and "CC". Is anybody able to explain how it works.
How may I send to multiple addressees ("TO's") and or "CC's" and "BCC's". What is obsolete in this script?
Many thanks in advance
Juerg
The personal liberty goes so far as it does not affect the liberty of others
5 REPLIES
Francisco J. Soler
Honored Contributor

Re: sendmail

Hi Juerg,

I have not checked how it works, but, you can send to multiple addresses with the sendmail alias capability, you can put an alias to the TO and CC fields and update the aliases file accondingly.

If you modify the aliases file you must run the newaliases command to rebuild the sendmail aliases database.

Frank.
Linux?. Yes, of course.
Tom Maloy
Respected Contributor
Solution

Re: sendmail

Mail addresses can be tied together with commas. So you should be able to put multiple recipients in double quotes. And I believe that you just need to send the mail once. Not sure about BCC, though.

#!/usr/bin/sh

export EMAIL_TO="dej,tbd"
export EMAIL_FROM=juerg.denneberg@ch.ey.com
export EMAIL_CC="dej,tbd"
export EMAIL_SUBJECT="Dienstleistungsertrag"
export EMAIL_ALL="$EMAIL_TO,$EMAIL_CC"

{
echo To: $EMAIL_TO
echo From: $EMAIL_FROM
echo CC: $EMAIL_CC
echo Subject: $EMAIL_SUBJECT
uuencode DLE.pdf Dienstleistungsertrag.pdf
} | /usr/sbin/sendmail $EMAIL_ALL

First, all of the variables are set (export). Then the sendmail input is constructed (inside the curly braces). Finally, sendmail receives it's input via the pipe.
Carpe diem!
Steven E. Protter
Exalted Contributor

Re: sendmail

Unix is nice that way, just pub commas between the addresses in the script.

I'm attaching a mail script for reference that also does attachments. Its got five input parameters but I added that and its easy to strip out.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dave La Mar
Honored Contributor

Re: sendmail

Juerg -
Attached is the sample given to our new people.
It covers different types fo email possiblilities. As others have stated, you email list can be in a variable with multiple addresees.

Best of luck.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."

Re: sendmail

Hi Tom

It works. Many Thanks

And Thanks also to all others involved

Regards

Juerg Denneberg
The personal liberty goes so far as it does not affect the liberty of others