Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix to MS-Outlook mail 1

Status
Not open for further replies.

unixkid

IS-IT--Management
May 22, 2001
105
US
I cant figure out when mailing from unix to Ms-Exchange account the files are being sent as body of messge instead of a attchment your required to open...Running from a script the following:
--------------------------------------------
DIR=/opt/files
EMAIL=user@domain.com
LMAIL-local@domain.com
if [ ! -z `ls ${DIR}` ]
then
print "Files exist"
ls ${DIR} | while read name
do
print "Sending Files to ${LMAIL}">> ${LOGFILE}
mailx -s &quot;Files sent&quot; ${EMAIL} < ${name}
done
else
print &quot;No files found&quot; >>${LOGFILE}
exit
fi
---------------------------------------------
 
EMAIL=user@domain.com
LMAIL-local@domain.com

I norice that your second address has a &quot;-&quot; instead of an &quot;=&quot;. Could this be the problem ? Or just a typo during creation of this post.

BV :)
 
yes that was typo on the post.

I found the in past day that you can't send attchments (only in body of text) via mailx program. So I'm using MIME64 script to encode the messages.
 
Hi UnixKid,

Would you like to post your solution? This question is asked quite frequently and I've never had a really good answer... Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Sure I'd be happy to post it.

If you wanted to just uuencode adding the attchement not in the body of message you can add a switch -m which says do not add MIME header lines Mime Version, Content Type & Content Encoding to the header information while sending mails.
example
# uuencode /tmp/testfile testfile.txt | mailx -m -s 'testje' test@mail.com

To acually add the MIME-64 Dave Wolton wrote a great script that anyone can vary for thier purposes using mmencode. In my case I added a few things at the header and called mmencode in a script to send multi files. Hope that helps someone get to the solution quicker next time. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top