0

I need to send my report.txt file to given mail address from my shell script.I tried this one:

  mailx -s "report" [email protected] < report.txt

it didn't send and it didn't give any error messages or something. Why it didn't work , i think it should be work ,there is no mistake in form. I use cent-os 5.7. I tried reinstall heirloom-mailx and it didnt fix. Beside, if you know any alternative way to send it, it will be help me too.

5
  • 1
    What do your logs say? Check /var/log/messages and your mail log. Commented Dec 20, 2011 at 15:28
  • Anything in the logs? Does it work at the console? Commented Dec 20, 2011 at 15:29
  • how can i do that? i wrote that in terminal and i get "bash: /var/log/messages: Permission denied" Commented Dec 20, 2011 at 15:30
  • no it doensn't work in console too Commented Dec 20, 2011 at 15:31
  • 1
    Use a pager -- less /var/log/messages -- and learn a little more Unix stuff ;) Commented Dec 20, 2011 at 15:31

1 Answer 1

1

Most probably you did not set up your smtp (outgoing mail) server correctly. There are several options, and you can even use your gmail account with e.g. ssmtp. Or Postfix. Or sendmail.

If it's set up, maybe the service is not running.

For the problem, I'd first check what your logs says (e.g. /var/log/messages*.

HTH

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.