1827147 Members
2981 Online
109716 Solutions
New Discussion

limit in mailx

 
SOLVED
Go to solution
Vishal Biyani
Advisor

limit in mailx

To emaail a message to multiple people we can use by using comma:
mailx -s "SUBJECT" "USER1@1.com,user2@2.com"

I want ot know if there is any limit on the number of users to which mail can be sent using this method?
Learning should never stop!
8 REPLIES 8
Matti_Kurkela
Honored Contributor

Re: limit in mailx

One limit is of course the maximum length of the command line. Usually it is *very* long, but not infinite.
MK
Peter Godron
Honored Contributor
Solution

Re: limit in mailx

Hi,
please see man mailx
" Recipient addresses specified on the command line must total less than
1024 characters in length. You may declare an alias or group (see
COMMANDS below) to specify a recipient address or list of addresses of
up to 8191 characters, and use that alias or group name (though each
address in the list must still be less than 1024 characters). If you
wish to specify a list of recipient addresses of greater length than
this, have your system administrator declare an alias or group in the
system alias file /etc/mail/aliases and use that alias name instead.
"
Yogeeraj_1
Honored Contributor

Re: limit in mailx

hi,

if you create aliases, the number of users can be "infinite"

see /etc/mail/aliases


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Vishal Biyani
Advisor

Re: limit in mailx

1)I will be getting this list of users to be mailed at runtime from some other source, so I can not created alises, plus the user running this script will not have toot access!

2) I gues I need to opt for second option in which the length of line should not be more than 1024
Learning should never stop!
Yogeeraj_1
Honored Contributor

Re: limit in mailx

hi again,

You can surely handle this programatically.

good luck!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Peter Godron
Honored Contributor

Re: limit in mailx

Hi,
you don't have to use the /etc/aliases file.
If you read the man pages you can use the alias command.

So you specify your alias in ~/.mailrc and can then use this to mail.

~/.mailrc
alias testalias a@a.com .....

echo "test message " | mailx -s"test message" testalias
Peter Godron
Honored Contributor

Re: limit in mailx

Hi,
could you please update this thread.
Has your question been answered? If so, please award points and close, identifying the solution.
Vishal Biyani
Advisor

Re: limit in mailx

Well I solved the problem programatically!
Learning should never stop!