Running redhat 8.0. I'm trying to send mail to 3 accounts via a script run as a cron job as root. The mail lines are similar to:
echo "$list" | mail -s "My List"
myaccount@mydomain.com
echo "$list" | mail -s "My List"
account2@domain2.com
echo "$list" | mail -s "My List"
account3@domain3.com
'mymyaccount@mydomain.com' is serviced by another mail server in the same domain as the host running the script. 'myaccount' exists on the local host and in the mail server servicing mydomain.com. Here's what happens...
1) With sendmail running as a server, the 2 mails to foreign domains are delivered OK, but the mail to 'myaccount' is delivered to the local machine and not the desired email server.
2) If I send to a different account in mydomain.com, the mail bounces with 'unknown user' errors as the account doesn't exist locally.
3) If I reconfigure sendmail to act as a client by configuring the 'SMART_HOST' in sendmail.cf, the correct server is used for 'myaccount', but then 'unable to relay' errors are generated for both "foreign" accounts.
I've tried various relay settings and creating /etc/mail/relay-domains, all to no avail. I'm fumbling in the dark though as I don't know sendmail well at all. Guidance in getting the mail to all 3 accounts would be appreciated. I don't care if sendmail acts as a server or a client, as long as the above works as desired. TIA,
bd