Sending email to group in bash

In shell scripting, TestEmail is an existing group email. I am using the below command to send emails who are existed under TestEmail . Unable to receive the email. I have tried group ="id1 id2 " .Its working and i tried creating alias as well.

Can we do it without creating alias or group ="id1 id2 " .

echo -e "This is Test Mail" | mail -s "ALERT: TEST MAIL" TestEmail

Hi,

I'm afraid I'm not quite fully understanding what might be the problem here. As it stands, your mail command syntax is fine and valid. So as long as TestEmail is a valid local user on your system, or a correctly-defined alias in your system's mail server configuration files, then the mail should work.

In order to dig deeper here, you'll need to look at the mail server logs for your system. They should reveal what happened to the mail, and if it was rejected or bounced they should also give you a clue as to why. On most Linux systems this will be /var/log/maillog , and you'll be able to look at it as root .

I hope this at least gives you some pointers as to where to look next. If you need further assistance then if you can give us a lot more detailed information about what you're doing, about what errors you're getting, and how exactly TestEmail is set up (either as a valid local user or as an alias, and if so please include its full entry in your mail server's config files), and hopefully we can go on from there.