Tag Archives: Content Disposition

Sendmail Png Attachments

By posner

I use sendmail to send html emails, my script works perfect and sends email with plain text attachment.

Now i need to attache png file to the email and this attachment part is not working.

Code:

(
echo "From: $FROM"
echo "To: $TO"
echo "MIME-Version: 1.0"
echo "Subject: $SUBJECT"
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"'
#echo "Content-Disposition: inline"
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat TheMailer.html
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/plain"
echo "Content-Disposition: attachement; filename=attachment_file.csv"
echo ""
cat attachment_file.csv
echo ""
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: image/png"
echo "Content-Disposition: attachment; filename="graph_file.png""
echo "Content-Transfer-Encoding: base64"
) | /usr/sbin/sendmail -t


TheMailer.html contains all my html command and its works good .
I get my email with plain text attachment but i don’t get the png attachment right , its just the file name with 0Kb

Appreciate your expert help in fixing this part

Code:

echo ""
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: image/png"
echo "Content-Disposition: attachment; filename="graph_file.png""
echo "Content-Transfer-Encoding: base64"


Thank you

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

HELP NEEDED – GNU/Linux – Sendmail – Attachment coming but mail body missing

By vikas_trl

Hello All,

I am working on a requirement in which I need to send an email (to outlook mailbox) with a html file attachment and mail body in html format.

I wrote the below code for sendmail. Code working fine and email is also reaching the recipient address but, mail body is missing completely and attachment is coming properly. It would be really great if someone can help me solve this problem.

My Code
(
echo “From: abc@somesite.com”
echo “To: xyz@somesite.com”
echo “Subject: Test”
echo “Cc: “
echo “Mime-Version: 1.0”
echo ‘Content-Type: multipart/mixed; boundary=”Th!51s80undary”‘
echo “Content-Disposition: inline”
echo ” “
echo “–Th!51s80undary”
echo “Content-Type: text/html”
echo “Content-Disposition: inline”
echo ‘Hello,

This is a test email.

Regards
echo ” “
echo “–Th!51s80undary”
echo “Content-Type: text/plain”
echo “Content-Disposition: attachement; filename=Attach.htm”
echo ” “
cat $Filename
) | /usr/lib/sendmail -t

PS: I tried mail attachment with mail body using mail command and i am receiving both mail body and attachment correctly. But I want the mail body to be in HTML format not plain text format.

‘(echo -e “Hello,nnThis is a test email.nnRegards” ; uuencode $Filename File.htm) | mail -s “Test email” “xyz@somesite.com”‘

Thanks in advance

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Syntax error `end of file' unexpected

By rajjev_saini123

I checked the forum and internet, tired different workaorunds but it didnt fixed the error.
Please advise on the code.

[code]#!/bin/sh
CWD=/home/test/Bench
cd $CWD
(grep “`date +%d-%b”`” File.txt) > /home/test/Bench/dateout
if [ -s / home/test/Bench/dateout ]
then
echo “data” > /home/test/ Bench /test
else
echo “File Empty
cat /home/test/ Bench /test > /home/test/ Bench /resultest
awk ‘!/get/’ resultest > /home/test/ Bench/output
awk ‘!/0x000/’ resultest > /home/test/Bench/output1
if [ -s /home/test/ Bench/output1 ]
then
MAILTO=”raj@yahoo.co.in”
CONTENT=”/home/test/ Bench /output1″
(
echo “Subject: Test”
echo “MIME-Version: 1.0”
echo “Content-Type: text/plain”
echo “Content-Disposition: inline”
cat $CONTENT
) | /usr/sbin/sendmail -t $MAILTO
fi
else
echo “bbb”
fi [./code]

Source: FULL ARTICLE at The UNIX and Linux Forums