Not sure if anyone around here can help me with this but I'm struggling w/ using ksh (Korn Shell) on a Red Hat machine to send an HTML message with a simple txt file attachment...
Here's what I have so far:
<!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.01 Transitional//EN\\" \\"http://www.w3.org/TR/html4/loose.dtd\\"><head>
<meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=iso-8859-1\\">
cat <<- _EOF_ | /usr/lib/sendmail -oi -t
Date: $(date +%Y%m%d)
Content-Type: multipart/mixed; boundary="MAIL_BOUNDARY";
Content-Type: text/html; charset="US-ASCII"
if [[ -n $attachment && -f $attachment && -r $attachment ]]; then
Content-Type: application/html; name="$logfilename";
Content-Disposition: attachment; filename="$logfilename";
When I send the message, I get it and there is a txt file attached, but the contents is never correct because it outputs shell code as the contents of the attachment--which tells me I have my MIME headers screwed up.
Any input / feedback is appreciated. The txt file is just a log file for a process we have.
Do I have to somehow use ksh to grab the contents of the file, store it in a variable, and then echo that variable inside the attachment area??? Pretty lost right now... (ksh is something I'm not very familiar with.)