Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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.