【发布时间】:2022-01-25 03:26:56
【问题描述】:
我想在 shell 脚本中以 HTML 电子邮件的附件形式发送员工详细信息 excel 表。我尝试使用下面的代码,但无法做到。
请帮忙。
if [[ -f /x/project/Emp_Report.xlsx ]]; then
echo "Employee Report exists !!"
(
echo "From: abc@gmail.com"
echo "To: xyz@gmail.com"
echo "cc: pqr@gmail.com"
echo "Subject:Employee Report"
echo "Content-Type: TEXT/HTML, multipart/mixed, text/html, application/octet-stream"
echo "Content-Transfer-Encoding: base64"
echo "Content-Disposition: attachment;filename=/x/project/Emp_Report.xlsx"
echo "<html>"
echo "<body>"
echo "<p>Hi Team,</p>"
echo "<p>Please find the Employee details in attachment.</p>"
echo "<p>In case of any queries, kindly reach out to 'abc@gmail.com'</p>"
echo "<b>Regards,</b><br>"
echo "Abc"
echo "</body></html>"
) | /usr/sbin/sendmail -t
echo "Employee Report Mail hase been sent successfully !!"
fi
【问题讨论】: