I need to send a mail regarding deployment of an application using shell script. For this I have just created a shell script and tested with
#!/bin/bash
TO_ADDRESS="to.person@domain.com"
FROM_ADDRESS="from.me@domain.com"
SUBJECT="Test mail"
BODY="hai friend, this mail is automated from shell script for Release automation."
echo ${BODY}| mail -s ${SUBJECT} ${TO_ADDRESS} -- -r ${FROM_ADDRESS}
But while running this script, it is printing like:
You have new mail in /var/spool/mail/jaykay
And a file named jaykay
is created in /var/spool/mail/
Why this is happening?
How can I send a mail using shell script?
And the output file looks like
From jaykay Wed Aug 20 04:08:53 2014
Return-Path: <jaykay>
Received: (from jaykay@localhost)
by e7021.com (8.14.4/8.14.4/Submit) id s7K98rdu004168;
Wed, 20 Aug 2014 04:08:53 -0500
From: Jini K Johny <jaykay>
Message-Id: <201408200908.s7K98rdu004168@e7021.com>
Date: Wed, 20 Aug 2014 04:08:53 -0500
To: to.person@domain.com, -r, --, from.me@domain.com
Subject: Test mail
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
hai friend, this mail is automated from shell script for Release automation.