Ec2: Setup mail to send emails
Solution 1:
This is a perfect fit for Amazon's Simple Notification Service. The service (also known as SNS) is simple to use from a bash script, free (for the first 100,000 messages, less than 1gb in total), and the notifications are immediate.
The setup for SNS looks like this:
From:SNS Documentation
It looks like a lot of trouble to send eMail, however, Amazon's EC2 environment is highly restrictive when it comes to sending eMail. Many have tried to use EC2 as a spam platform, so Amazon has been thorough in blocking SMTP (eMail) traffic, except as prescribed by Amazon. You can't just open up a port on the Amazon security group to bypass Amazon's blocks.
Amazon does have a general eMail facility one can use from within EC2. It is called, Amazon Simple Email Service (SES). That will not work well for you, as it is designed for bulk eMail. So, SES's pricing, exception handling and messaging won't fit well with your application as I imagine it.
SNS, on the other hand works great for this. It includes an initial eMail to the recipients (your build users) asking if they want to receive future messages of the topic; they are given an option to opt out, and must reply to receive further.
The setup process (shown in blocks above) is all easily doable from Amazon's AWS Management Console. (Your question implies you that you already have an AWS EC2 account needed for this.) Once setup, your command from bash would be similar to:
$PROMPT> sns-publish arn:aws:sns:us-east-1:365928882516:Foo --message "Hello, world!"
The example above is done using the Command Line Interface available for SNS. This Command Line Interface is available at: (Amazon Simple Notification Service Command Line Interface Tool), and it's documentation is here: (Amazon Simple Notification Service Command Line Interface Documentation). Set it up first though, as described above.
It'll be gotcha-free in setting up, and solid as a rock in operation.
Solution 2:
Note that in the latest version of the CLI, which now combines AWS services into one executable, the syntax has changed slightly. The above command would now be:
$PROMPT> aws sns publish --topic-arn arn:aws:sns:us-east-1:365928882516:Foo --message "Hello, world!"
Also note that if you haven't set the AWS_DEFAULT_REGION environment variable (this is not set by default on AMAZON Linux AMIs, for example), you'll need to specify the region:
$PROMPT> aws --region us-east-1 sns publish --topic-arn arn:aws:sns:us-east-1:365928882516:Foo --message "Hello, world!"
Source: Amazon's unified CLI documentation.
Solution 3:
If you use your own mail server (on Centos), remember to remove the EC2 email sending limit!
http://aws.amazon.com/ec2/faqs/#Are_there_any_limitations_in_sending_email_from_EC2_instances