#!/bin/bash
### script to send email with attachment ###
### Declare Email Subject
SUBJECT="TESTING EMAIL"
## Declare Reciever's Email Id
EMAIL="reciever@testemail.com"
## Declare CopyTo Email Id
COPYTO_EMAIL=copyto@testemail.com
destfile="/home/acer/text.txt"
## Removing output files of the script from previous run
rm -f out.mail
## Remove the message body and sent files used in previous versions
rm -f mailbody.txt
rm -f OUTPUTRESULT.CSV
## Create the mail body message in a text file
## Initialize the text file
cat > mailbody.txt
echo "Hi User,\n" >> mailbody.txt
echo "The result file for the server - SERVERNAME - is attached with this email.\n" >> mailbody.txt
echo "\n\nRegards,\nAdmin" >>mailbody.txt
## Sending email using mail command
cat mailbody.txt > out.mail
# Copy the OUTPUT.CSV file generated to another file OUTPUT_RESULT.CSV
uuencode $destfile >> out.mail
# are in their respenter code hereective variables - $SUBJECT and $EMAIL.
mail -s "$SUBJECT" "$EMAIL" "$COPYTO_MAIL" < out.mail
echo "Email sent."
在此脚本中执行邮件命令后,终端会提示用户输入。当我按 ctrl+d 时,只显示发送的 msg 电子邮件。
它不应该要求用户输入。
我能做什么?
你能告诉我为什么它会提示用户输入吗?