Operating System - Linux
1751975 Members
4530 Online
108784 Solutions
New Discussion юеВ

attachments with sendmail

 
SOLVED
Go to solution

attachments with sendmail

Hi,

Does anyone Know how to send file attachments using sendmail. The only way I've managed so far is the following:
#cat | sendmail

Thanks in advance,
Trystan.
6 REPLIES 6
U.SivaKumar_2
Honored Contributor

Re: attachments with sendmail

Hi,

Read somewhere
TXTFILE=/tmp/textfile
MAILTO=user@remote.com
SUBJECT=attachmentmail
echo "From: $LOGNAME\nTo: $MAILTO\nSubject: $SUBJECT\nMime-Version: 1.0\nContent-Type: text/plain\n" > /tmp/file
cat $TXTFILE >> /tmp/file
/usr/lib/sendmail -t -oi < /tmp/file

regards,
U.SivaKumar

Innovations are made when conventions are broken

Re: attachments with sendmail

Hi,
I've put this into a script however this sends the file as the body of the e-mail and not as an attachment.
Thanks,
Trystan.
Jerome Henry
Honored Contributor
Solution

Re: attachments with sendmail

I would rather type
uuencode (, not required)| sendmail
You can lean only on what resists you...
Sergejs Svitnevs
Honored Contributor

Re: attachments with sendmail

Check out the following script to email files as attachments:

http://home.clara.net/dwotton/unix/mail_files.txt

Regards,
Sergejs
John de Villiers
Frequent Advisor

Re: attachments with sendmail

i use this

/usr/sbin/sendmail -f$FROMMAIL $TOMAIL << ENDOFFILES
Subject: Data Files
`/usr/bin/uuencode $CFGFILEPATH/$CFGFILE1.txt $CFGFILE1.txt`
`/usr/bin/uuencode $CFGFILEPATH/$CFGFILE2.txt $CFGFILE2.txt`
`/usr/bin/uuencode $CFGFILEPATH/$CFGFILE3.txt $CFGFILE3.txt`
ENDOFFILES

Re: attachments with sendmail

Hi,
Thanks for the responses, this is now working.
Thanks,
Trystan.