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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email with body and attachment 1

Status
Not open for further replies.

isabelleleiwi

Technical User
May 21, 2003
1
GB
From an aix server, I would like to send an email with a subject, body, and file attached.
how do I add the attachment to the line below?
echo "body" | mail -s "subject" emailaddress
thanks,
 
Of course you can use sendmail to send a file as an attachment
sendmail user@system < file

Also there are a couple of good tools you can use called mpack and metamail that can be downloaded from the UCLA seas download site
 
Using mpack by John G. Myers

The mpack program is a program that uses MIME encoding and mails the attachment to an address. An AIX version of the program is available from
With this program, you can specify the MIME type of the file, or let the program decide for you. With mpack, you can specify the message subject with the -s flag, specify a text message file to go in the body of the message with a -d flag, specify the content type with a -c flag, and then specify the attachment filename and the destination address. In most cases you can leave out the content type and the program will figure it out for you. For large attachments you can also specify a split size to split the file into smaller fragments.

To send an attachment with no message use:

mpack -s &quot;subject here&quot; attachment_file email_address

To send an attachment with a message put the message in a message file and use:
mpack -s &quot;subject here&quot; -d message_file attachment_file email_address

For example if you have an html file and you use sendmail and send it to a notes user, it will come to the user as html source, but if instead you use mpack it will come as a note html attachment and the user will be able to read the document.
 
Try this,
uuencode source target |mail -s &quot;subject&quot; e-mail_add
 
Another package worthwhile looking at is &quot;matt&quot;, it can send multiple attachments, one better than mpack.

Available at the ULCA site or Bull:




IBM Certified Confused - MQSeries
IBM Certified Flabbergasted - AIX 5 pSeries System Administration
MS Certified Windblows Rebooter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top