The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > How do I send email?
.
google unix.com



How do I send email? Learn how to send a UNIX or Linux email attachment from the command line.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sending email attachments venush UNIX for Dummies Questions & Answers 2 06-06-2008 02:42 AM
Sending text files as attachments radhika03 Shell Programming and Scripting 2 06-07-2007 11:17 AM
sending attachments in mail rajendragora UNIX for Dummies Questions & Answers 6 02-01-2007 12:13 AM
sending attachments via unix Abhishek Ghose UNIX for Advanced & Expert Users 6 09-30-2005 05:49 PM
sending files as attachments SmartJuniorUnix UNIX for Dummies Questions & Answers 9 04-13-2001 08:34 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-11-2001
pete pete is offline
Registered User
  
 

Join Date: Apr 2001
Posts: 6
Question Mailx attachments

Caveat: this is the "dummy" forum, right?
That's where I belong. How do I find mimencode? I did a 'which mimencode' from the command line, and I can't find it. I'm running on a solaris 2.6. Thanks
  #2 (permalink)  
Old 04-11-2001
PxT's Avatar
PxT PxT is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
mimencode (also known as mmencode) is part of the metamail package. You can get a solaris version here: http://www.ibiblio.org/pub/packages/solaris/sparc/
Download to /tmp and "gunzip" it. Then do a "pkgadd -d /tmp"

You should now have mimencode installed in /usr/local/bin

Then you can run something similar to the following script (pipe it to mailx)

#!/bin/bash
#
# Script: sendfile
#
# Purpose: Send the specified file via email as a MIME
# attachment to the specified address.
#
# Author: Anthony E. Greene <agreene@pobox.com>
#
# License: GPL <http://www.gnu.org/>
#
# Note: This script does not include any error checking, so
# it should only be called from within other scripts.
# The correct syntax for using this script is:
#
# sendfile filename user@domain | /path/to/sendmail -t
#

# First we set up some global variables.
# Some code should be added to verify the commandline arguments.
sender=you@yourdomain.com
filename=$1
basefile=`/bin/basename $filename`
recipient=$2

echo From: $sender
echo To: $recipient
echo Subject: File $basefile
echo MIME-Version: 1.0
echo "Content-Type: multipart/mixed; Boundary=\"sendfile-attachment-boundary\""
echo
echo --sendfile-attachment-boundary
echo 'Content-Type: text/plain; charset=us-ascii'
echo
echo This is a MIME encoded message. If your mail software
echo cannot properly handle the attached file, you may need
echo to get a MIME-aware mailer.
echo
echo --sendfile-attachment-boundary
echo "Content-Type: application/octet-stream; name=\"$basefile\""
echo Content-Transfer-Encoding: base64
echo "Content-Disposition: attachment; filename=\"$basefile\""
echo
/usr/bin/mimencode $filename
echo --sendfile-attachment-boundary--
  #3 (permalink)  
Old 04-13-2001
pete pete is offline
Registered User
  
 

Join Date: Apr 2001
Posts: 6
Thumbs up

Thanks! I'll give it a try, but I'm not an SA, and in the past they haven't given me root access to install packages.
I'll see what I can do. The responses have been very helpful. Thanks again
 

Bookmarks

Tags
mailx, mailx attachment, sendmail

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0