我有以下功能使用邮件。 如何在其中添加cc或bcc? 这样做不起作用:cat<< EOF |邮件$ {CONTACT_EMAIL} -b email@email.com.br ...
function SendMail () {
# Getting e-mails body text
TEXT=$(cat ${LOG_DIR}/${PROCESS_ID}.log)
cat << EOF | mail ${CONTACT_EMAIL}
From: ${MAIL_FROM}
Subject: X
To: X}
Cc: Leandro.Takeda@teste.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"
---q1w2e3r4t5
Content-Type: text/html
Content-Disposition: inline
X
EOF
}
答案 0 :(得分:1)
man mail
我的补偿建议-b a,b,c
应该先发送到地址。
mail -b email@email.com.br ${CONTACT_EMAIL}
答案 1 :(得分:1)
您可以在没有sendmail
计划帮助的情况下直接使用mail
程序。
SENDMAIL=/usr/sbin/sendmail
${SENDMAIL} -i -- ${CONTACT_EMAIL} Leandro.Takeda@teste.com jd@example.net <<EOF
From: ${MAIL_FROM}
Subject: X
To: ${CONTACT_EMAIL}
Cc: Leandro.Takeda@teste.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"
---q1w2e3r4t5
Content-Type: text/html
Content-Disposition: inline
X
EOF