0

I am trying to send an email using below shell. However, at a time, this command is sending content in email body and not as an attachment. Please suggest what could be the correct syntax or logic to send both email body and attachment together in a single mail.

smtpserver="0.0.0.0"
sender="email_id"
subject="subject"
MSG="message"
ReportFile="<PATH>/attachment.csv"
CLASSPATH="<classpath>/attachment.csv"
htmlfile="output.html"

java -cp $CLASSPATH:$CLASSPATH/ojdbc6.jar ClassFile > $ReportFile

awk -F, 'BEGIN{
FS=",";
print "data shown as below"


print "<html><body><table>"
}
{

for(i=1; i<=NF; i++)
{ 
print "<td>" $i "</td>"
}
print "</tr>"
}
END{
print "<html><body><table>"
}
'   $ReportFile > $htmlfile

/home/mailsend-smtp $smtpserver -content-type 'text/html' -mime-type 
"text/html html" -t $receiver -f $sender -sub "$subject"  -msg-body 
$htmlfile -attach $ReportFile

1 Answers1

0

I don't know the mailsend-smtp tool but you can use one of the several built-in command on linux to do that

Try this

Joao Vitorino
  • 2,976
  • 3
  • 26
  • 55