sendmail attachment issue

Hi All,,

After long time,

might be this is nth time post on this forum for the same query...but i tried browsing for sometime and i did not get what i wanted :slight_smile:

i have following syntax in my shell scripting..

(cat filename.txt
uuencode attachment attachment)|/usr/lib/sendmail -t emailid.test@email.com

above syntax did not through any error...but when i see my email..it does not have an attachment in it and body of my email having some unwanted characters..

seems uuencode proplem..not able to understand ..since its quite urgent..to make correction in my script as well..

Appreciated ..if somebody could help me here..

Thanks in advance
Sha;)

usually, uuencode is used in this way,

uuencode filename.txt filename.txt | mail......

if you want to change the filename at destination, put the another filename at the second argument in uuencode.

never used sendmail, but this is how I used in mailx.

/usr/lib/sendmail -t -i <<EOF
To:  emailid.test@email.com
Subject: Here is some 

Some messagetext ex. $(date)

or some file like:
$(cat message.txt)

$(uuencode some.gif some.gif )

EOF

What is in "filename.txt" ? Is it commands to sendmail?

What type of file is "attachment" ? Is it a text file?

What Operating System and shell do you have. It matters here because of your use of brackets.

No, it's only example - some textfile including some text = message body. Attachment is some binary file.
Previous only example how nice method HERE is to make ex. mail template.

/usr/lib/sendmail -t -i <<EOF
To:  emailid.test@email.com
Subject: Here is some 

$(uuencode some.some some.some )

EOF

/usr/lib/sendmail -t -i <<EOF
To:  emailid.test@email.com
Subject: Here is some 

Some body text and attachment also.

$(uuencode some.zip some.zip )

EOF

Try it, easy to see result.

You need only sendmail binary - somewhere = give the path
and shell ex. bash, ksh, dash, ... Operating system - select some.

If you have old Bourne Shell, nothing else, then you must write command substitution using old format
$( cmd ) => ` cmd `

/usr/lib/sendmail -t -i <<EOF
To:  emailid.test@email.com
Subject: Here is some 

`uuencode some.some some.some `

EOF