You don't send email to a "group id". You must set up a forwards or alias file, create a name for that alias (usually the group name), and list each of the members in that group. In theory, you can dynamically generate that group on a daily basis. Or, you can have an email address tied to a program, which dynmacially determines the email list.
If you are using sendmail, the file you want to edit is /etc/aliases.
I am using mail command, i am not that much aware of sendmail.
here is my script:
#!/bin/ksh
mailaddress=$(cat $HOME/email.txt)
(cat | mail -s "TESTING LOAD STATUS on `date`" "$mailaddress") <<EOD
ignore. this is a test mail
EOD
where the email.txt file contains:
My script is taking the list of mail id's from email.txt file. However, the list contains a group id also and failed to send/receive. but the same was successfully received at arunprasad@mail.com - Individual mail id.
I have a question here. Is there any limitation in mail id what we are mentioning in mail command? Say for example 'my.friends.group.mail@mail.com' contains three periods - four words in a mail address. The same case is also applicable for individual mail id like 'arun.t.prasad.thangaraj@mail.com'. So i am suspecting this is not the issue with mail address type: whether group id or individual id. But seems like mail address length?
You can use sendmail client to send mail. Only need to look where is your sendmail.
Using sendmail give more ... here is example to use sendmail. In this example you can put many emails on same line using , delimeter or put every email in the own line = better, everyone get individual mail.
#!/usr/bin/ksh
MessageFile="xxx.txt"
SM="/usr/lib/sendmail -t -i"
Sender="my.address.what.ever@some.subdomain.company.domain"
Subject="Something"
BackupMailBox="someaddress@some.domain"
Timestamp=$(date '+%Y-%m-%d %H:%M:%S')
message="Hello world"
for To in $(cat $HOME/email.txt)
do
$SM <<EOF
To: <$To>
Bcc: <$BackupMailBox>
From: <$Sender>
Subject: $Subject $Timestamp
$Timestamp
$message
$(cat $MessageFile 2>/dev/null)
EOF
done
Hi thanks for idea.
However, i am having this issue in production box and this is replicated in many of the scripts.
Changing mail to sendmail in all scripts is not possible.
Is there any possibilities to resolve this issue with 'mail' command?
This is not really the point. If you are using a "production" box, you must be aware of the underlying mail system. Anyway, refer to my original response. The problem is emailing to a group.