Originally Posted by cli
Where should I edit this i.e the /etc/mail/sendmail.mc is from our mail server or any local PC/Laptops where shell script will be running.
It would be on the client machine doing the sending of the email. I spent 5 minutes reading the mail man page searching for the string "port". There's an smtp string option that can be defined as...
echo "Test mail" | mail -S smtp=smtps://server:port -s "Test" email@example.com
If it were me I'd want to edit the config global config files rather than a script hack. The same fix (from my first post) is not for both sendmail and postfix. Fix it for the appropriate software you have installed on the server needing to send the mail. That would be my recommendation. That and look to man pages.