How to use an email relay server from cmd line

0

I have some cronjobs that run on our servers that monitor processes, run automated jobs, etc. These scripts mail alerts for our monitoring or mails out the automated job results, etc. using the mail command.

mail -s "test subject" < emailbody.txt

We are outgrowing our current cluster and need to migrate to a bigger cluster. However, due to reasons unknown to me, the new cluster we're migrating to doesn't allow emails to be sent from each server, which is making my scripts not do their job since they can't email things to us.

Someone said we have to use the email relay server on this cluster/network. How do I make use of the email relay server from the unix mail command? Do I need to make changes to some OS level config files or is it some command option I can specify from the mail cmd? Thanks in advance for your help.

EDIT: The new servers are running CentOS release 6.5. I don't know how much we can install/edit on the servers since our IT dept has locked it down and we don't have root access. I don't think we can sudo as root either.

Classified

Posted 2014-09-03T21:12:02.337

Reputation: 190

I recommend to read some documenttion about mail on linux for your distribution. You will not get THE one and only answer here, as there are so much different ways here. – frlan – 2014-09-03T21:23:58.187

@frian thanks for your comment. i skimmed the man pg and searched for the word "relay" in the man pg but didn't find anything b4 posting here. i'll keep poking around google though. i just wish i was smart enough to phrase my question in a form understandable by computers :/ – Classified – 2014-09-03T21:30:02.520

Don't lok for relay. Look for mail setup of your didstribution. Try to understand conecepts of MTA und MDA on Linux -- it will help you in future. – frlan – 2014-09-03T21:30:56.193

Did you think about asking the IT dept what the solution is for sending email from a script? It's a common need. – Tyson – 2014-09-03T22:17:51.647

Answers

0

You can use ssmtp, msmtp, or similar programs to relay your mail through some other SMTP server.

jjlin

Posted 2014-09-03T21:12:02.337

Reputation: 12 964