- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: MAILX oneliner to more than one addressee
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2009 07:29 AM
тАО07-01-2009 07:29 AM
cat $file2 |mailx -s "sMail Subject" UnixTeam@ANother.com first.name@ANother.com second.name@ANother.com third.name@ANother.com
the command works fine from the prompt or within the script (when only one mail address is used) however what is the correct syntax to use within a script as no mails are sent at all not even to the first recipient?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2009 07:33 AM
тАО07-01-2009 07:33 AM
SolutionSeparate the addresses with commas
echo "steve was here" |mailx -s "sMail Subject" invest,root
echo "steve was here" |mailx -s "sMail Subject" invest@yourdoman.com,root@yourdomain.com
Check /var/adm/syslog/syslog.log for delivery success.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2009 07:40 AM
тАО07-01-2009 07:40 AM
Re: MAILX oneliner to more than one addressee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2009 07:57 AM
тАО07-01-2009 07:57 AM
Re: MAILX oneliner to more than one addressee
as you can guess, the command line has a limited length and you might not be able to fit all the recipients to a single line. In which case you either set up an environment variable (again with the limitations, like
maillist="user1@domain.com,user2@domain.com,..."
mailx -s "subject here" $maillist
or you can edit the /etc/mail/aliases file and create an alias mail list, entering email addresses over there, like this:
user1 : someone@domain.com
user2 : someone.else@another domain.com
user3 : stranger@strangeplace.com
hpuxadm : user1,user2,user3
save and exit
then
mailx -s "subject here" hpuxadm
Hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2009 07:59 AM
тАО07-01-2009 07:59 AM
Re: MAILX oneliner to more than one addressee
newaliases
to compile the aliases file into the database form that sendmail/mailx understands.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 12:58 AM
тАО07-02-2009 12:58 AM
Re: MAILX oneliner to more than one addressee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 05:32 AM
тАО07-02-2009 05:32 AM
Re: MAILX oneliner to more than one addressee
Unless you have a quoting issue:
USERS="abc@def.com def@ghi.com"
mailx -s "test" "$USERS"
This won't work, you have to add those commas or remove the quotes.