Reputation: 323
I'm trying to loop over each line in a text file where each line is a URL and then send each line from the same email address, to the same email address using sendmail.
I'm running OS X and doing trying to do this with a bash script and this is what I have so far
while IFS= read -r line
do
echo $line
echo $line | sendmail -f [email protected] [email protected]
done < readinglistlinksfromsafari.txt
Problem is, the messages sent are all empty, even though the links echo out correctly. What do you think this could be?
I'm fairly new to this so you'll have to forgive my ignorance.
Upvotes: 1
Views: 1258
Reputation: 10903
Sendmail expect header and body separated by empty line.
while IFS= read -r line
do
echo $line
/usr/sbin/sendmail -i -f [email protected] [email protected] <<END
Subject: MySubject
From: [email protected]
To: [email protected]
$line
END
done < readinglistlinksfromsafari.txt
Upvotes: 2