mail to multiple recipients | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

mail to multiple recipients

UNIX for Dummies Questions & Answers


Tags
sendmail

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-18-2002
peter.herlihy peter.herlihy is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 1 August 2006, 11:51 AM EDT
Location: New Zealand
Posts: 333
Thanks: 0
Thanked 0 Times in 0 Posts
mail to multiple recipients

I've searched far and wide (including forums - so please don't tell me to look there) ...and I have a presumably simple request...

how do I specify multiple recipients to send mail to usnig the mail command.

I've got this

(cat mail_message ; uuencode test.file test.file ) | mail john_smith@the_moon.com

However, how do I also send to another recipient on the same command line. Obviouly could replicate the line - but don't think I need to.....

Sponsored Links
    #2  
Old 02-18-2002
peter.herlihy peter.herlihy is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 1 August 2006, 11:51 AM EDT
Location: New Zealand
Posts: 333
Thanks: 0
Thanked 0 Times in 0 Posts
I've got it using mailx - but am still curious about mail

(cat mailtext ; uuencode test.log test.log ) | mailx 'peter@dot.com, john@dot.com'

That works.......

Simple (with quotes) - but with the mail command (instead of mailx) it says "Recipient names must be specified"
Sponsored Links
    #3  
Old 02-19-2002
thehoghunter
Guest
 
Posts: n/a
I'm on Solaris 2.6 - used the following with no problem:

$ mail joeuser@mycom.com,joeuser@yahoo.com < /etc/motd

Worked under ksh and csh.
    #4  
Old 02-19-2002
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
 
Join Date: Nov 2001
Last Activity: 23 October 2011, 10:07 PM EDT
Location: Brisbane, Australia
Posts: 509
Thanks: 7
Thanked 0 Times in 0 Posts
I've used the following with success in the past.

Code:
xemails="cameron@SomeDomain.com,someoneelse@SomeDomain.com"
#
function SendEmail {

  xsub="Some Subject Of Your Choosing."
  mail -s "$xsub" $xemails < $1

}  ## End-of-function SendEmail

Sponsored Links
    #5  
Old 02-19-2002
Neo's Avatar
Neo Neo is offline Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 20 October 2014, 7:50 AM EDT
Location: Asia pacific region
Posts: 13,023
Thanks: 522
Thanked 877 Times in 402 Posts
/etc/aliases

The aliases file for sendmail allows you to point to a file; so the way I do what you are asking is to put the names in a file that is part of /etc/aliases and send mail to the alias.
Sponsored Links
    #6  
Old 02-19-2002
usfrog usfrog is offline
Registered User
 
Join Date: Dec 2001
Last Activity: 9 July 2009, 9:28 PM EDT
Location: San Jose CA
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
On HP-UX I could put a list of recipients separated with just a space, and it worked:

cat $myFile | /usr/lib/sendmail -i -t

with in myFile a line like:
To: aaa@whatever.com bbb@whatever.com

Hope this will help.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sendmail not showing recipients MaindotC UNIX for Advanced & Expert Users 8 08-19-2012 08:17 PM
Multiple recipients with sendmail big123456 UNIX for Advanced & Expert Users 6 12-29-2010 12:40 PM
Python: multiple email recipients jelloir Programming 0 12-08-2009 05:16 PM
using mailx with multiple recipients sdhalepaska UNIX for Dummies Questions & Answers 6 08-18-2008 05:17 AM
Mail to multiple reciepent arpitk Shell Programming and Scripting 4 11-02-2006 09:30 AM



All times are GMT -4. The time now is 09:01 AM.