sendmail
在自动化中经常需要将日志文件发送到指定用户组,于是记录一下使用sendmail发送邮件及附件的shell脚本模板
#!/bin/bash
MAILFROM="noreply@`hostname -f`"
MAILTO="[email protected]"
subject="Sendmail templete test"
attachMENT="XXXXXXX20190227.log"
MAILPART=`uuidgen` ## Generates unique ID as boundary
MAILPART_BODY=`uuidgen` ## Generates Unique ID as boundary
(
echo "From: $MAILFROM"
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "content-Type: multipart/mixed; boundary=\"$MAILPART\""
echo ""
echo "--$MAILPART"
echo "Content-Type: multipart/alternative; boundary=\"$MAILPART_BODY\""
echo ""
echo "--$MAILPART_BODY"
echo "Content-Type: text/plain; charset=UTF-8"
echo "This is TEXT part and below is HTML part"
echo "--$MAILPART_BODY"
echo "Content-Type: text/html; charset=UTF-8"
echo ""
echo "<html><body><p>THIS IS HTML PART</p></body></html>"
echo "--$MAILPART_BODY--"
echo "--$MAILPART"
echo 'Content-Type: text/plain; name="'$(basename $ATTACHMENT)'"'
echo "Content-Transfer-Encoding: base64"
echo ""
openssl base64 < $ATTACHMENT;
echo "--$MAILPART--"
) | sendmail -t
文章最后发布于: 2019-02-27 15:48:45
相关阅读
概述 什么是zeronet,首先我一直想写这么一篇博客,但是你懂得我为什么不写,但是不写就不完美了啊,于是
在linux环境,应用需要记录KPI的数据统计,代码中获取时间函数,localtime(),asctime查看,获取事件为东八区的时间,与当前系统时间一致,而
如何在nuxt项目中使用百度地图 进入百度地图API选择javascriptAPI,按照流程注册账号获取ak,复制ak按照页面提示的,需要引入script标
使用padding-bottom和margin-bottom实现两栏等高布局
声明:以下均为个人见解,若有错误请指出。效果预览:<!DOCTYPE html> <html> <head> <title>demo</title> <style type="tex
Word文档打不开提示“发送错误报告”怎么办?相信不少朋友都有过跟我一样的经历,双击启动Word时提示Microsoft Office Wor