• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Sending email using unix's command mail problem

Dear all,,

Can anyone tell me how to send an email with aa file attachment by using unix's command mail?


1 Solution
You don't give flavor of unix but I use mailx to send attachments.

Example: mailx username
Subject: here's your file

Enter whatever text you need to and then to attach the file type:

~r filename

To complete the message and send it, type a . on a new line.

I also know that pine can send attachments but am not real familiar with it.
benson031397Author Commented:
OK!  Thanks!
~r does not make an attachement, it just "includes" into the normal body
There is no standard (command-line) mail program to do this.
You either need a more sophisticated one like pine, or use perl with MIME::Lite;
As ahoffmann explained above, ~r does not make attachments, just reads files.

However, most modern versions of mailx do understand attachments.  Read the main page for mailx on your system.  If yours doesn't however, there are still a few good ways to go.

As ahoffmann pointed out above, pine will do the job, but it's really designed for interactive use and isn't very good in scripts.  The perl mechanism pointed out by ahoffmann above works much better in scripts.  Finally, you can also use Bellcore's Metamail program, which is available from, among other places, ftp://ftp.bellcore.com/pub/nsb/mm2.7.tar.Z

Some good backgrounds on the subject include the comp.mail.mime FAQ, available from, among other places, http://www.bilkent.edu.tr/bilkent/services/info-lib/online-docs/Online/Mail/mime-faq/top.html and the University of Indiana' page at http://www.uwsg.indiana.edu/usail/mail/mime/mime.html

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now