Alex Rivera | Logout

Sending a mail from a linux shell script

Asked 2011-03-01T14:36:46.327
145

I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?

Edit
Report

1 Answer

7

Admitting you want to use some smtp server, you can do:

export SUBJECT=some_subject
export smtp=somehost:someport
export EMAIL=someaccount@somedomain
echo "some message" | mailx -s "$SUBJECT" "$EMAIL"

Change somehost, someport, and someaccount@somedomain to actual values that you would use. No encryption and no authentication is performed in this example.

answered 2012-10-11T16:22:53.463

Your Answer