I want to email a html file and some images to someone from a script. The standard answer seems to be to use mutt. However I don't have that installed at the moment.

  • Is there another way I could do it?
  • Is there any security vulnerbilities with installing mutt?
  • I don't need a full on mail reader, I just wanna send some attachments, is there another solution?

mail, mailx and it's derivatives are the most commonly used MUAs for such jobs.

You'll find them much leaner to install and maintain than mutt.

It's important to note that some of the derivatives don't make sending attachments as easy as others.

| improve this answer | |
  • How do I send attachments? – Rory Aug 4 '09 at 14:47
  • "man mailx" has all the answers. – innaM Aug 4 '09 at 14:52
  • man uuencode will also help – goo Aug 4 '09 at 14:53
  • It depends on the specific version you have. You might be interested in this thread though - serverfault.com/questions/17589/… – Dan Carley Aug 4 '09 at 14:55

To send attachments using mailx:

(uuencode file1.png file1.png
 uuencode file2.html file2.html
 echo "this is in the message body") | mailx -s "This is the Subject" kyle@kylerocks.com

uuencode is included the the sharutils package.

| improve this answer | |
  • 2
    Technically they aren't attachments </pedant> – Dan Carley Aug 4 '09 at 15:12
  • Why not? (Not trying to be argumentative) even you are being pedantic, I don't know the difference, and I don't like not knowing :-) – Kyle Brandt Aug 4 '09 at 17:38
  • 3
    The it'd be a pleasure to explain :) If you take a look at the source of an email produced by the above then you'll see that the body contains the raw uuencode's without any boundaries. Most MUAs will interpret these uuencoded content as attached files, but some will not and truly they aren't. Real attachements are sent as part of a MIME multipart message which defines the bounaries and types for each part. – Dan Carley Aug 5 '09 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.