Hi there,
I can send a test email from the web page (mail settings), but how do I send an email from a bash script? I have tried:
mail -s 'subject' email-address
but it doesn't work. Please help.
thanks in advance
Ziggy
I can send a test email from the web page (mail settings), but how do I send an email from a bash script? I have tried:
mail -s 'subject' email-address
but it doesn't work. Please help.
thanks in advance
Ziggy
Share this post:
Responses (7)
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
It looks like mailx is required by app-smtp-core so it should be installed, as should postfix on a default install. The only point I can see of installing the SMTP server is that you get a webconfig screen to start and stop postfix.
I was wrong about perl. The Mail Settings/Mail Notification app uses a very old version of the Swift PHP mail app, but I don't know beyonf that. I think it has its own mini-smtp server which is why it won't do STARTTLS (until it gets updated). -
Accepted Answer
As Nick indicated you must have a working SMTP server, usually postfix with ClearOS. Also, to use the example command Nick provided you must have the mailx rpm installed. I cannot remember if that rpm is installed by default or whether you must explicitly install it. Use something very similar here to send automated emails from crontab entries at set times.
You can also
cat /some/file | mail -s 'Gateway down' [email protected]
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
I think you have to have a body (the 'echo' bit of my line) or the mail program hangs waiting for input. It is just possible that you need the SMTP server installed, but I don't think so.echo 'Gateway down' | mail -s 'Gateway down' [email protected]
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »