Send an email from shell script with attachment


Requirement is to send an email with file as an attachment using shell script.

Sample Shell Script:

#!/bin/ksh

#*******************************************************************************

# Name : HH_TEST_SHELL

# Date : 19-MAY-2023

# By : AskHareesh

# Description : Execute JAR File

#*******************************************************************************

MAILBODY="Hi Team,

Please find the attached report."

MAIL_SUBJECT="Sales Order Status Report"

VALIDATEEMAILS="askhareesh@gmail.com"

LOGDIR="/test/dir/"

LOGFILE="SalesOrderReport.csv"

(echo  "$MAILBODY" ; uuencode $LOGDIR/$LOGFILE $LOGFILE) | mailx -s "$INSTANCENAME : $MAIL_SUBJECT" $VALIDATEEMAILS

*/

No comments:

Post a Comment