# Sending files through email

Warning: Do not attempt to send a file larger than about 10MB through email. It may bounce back or it may cause the recipient's mail spool to fill up. Also be wary of emailing .zip files. Because many viruses distribute themselves in this format, they will often be rejected. Small .tar.gz files (the Linux equivalent of .zip) should be OK to email, however.

Although plain text files can simply be included in the body of the email, files are normally emailed as attachments (with a covering note explaining what they are).

When you receive an attachment, you can usually just tell your mail client to view it, and the correct program will be launched (e.g. evince for a pdf file). If this does not work, there should be an option to save the attachment, and you may want to inform help@maths of the problem.

## Pine

• To view an attachment, press ">" for a list of message parts, select the one you want, and press Return to view or S to save.
• To send an attachment, press Ctrl-J and follow instructions.

## Webmail

• To view or save an attachment, click on it.
• To send a message with an attachment, click "Attach a file" or "Attachments" while composing your message.

## Embedded attachments

Sometimes you will receive an email which appears to be encoded, containing solid blocks of characters in the body of the email. When this happens you need to save the message to a file and use a Unix command to decode it.

### Saving the message

• In Pine, display the message and press E for Export.
• In Hermes webmail, display the message then click "More" (at the top of the window) and choose Download.

I'll refer to the file containing the saved message as message.orig.

### Decoding the message

base64 is an encoding scheme which produces blocks of characters like this:

lra2NpfLFRkZubS09PT0JBKJiETi9PQ0k8nE4XBjY2O5ubmTk5OFhYUfHx/v7+9qtVqp
VLJZ7M/PT7lc3tDQQCaTq6ura2pq6uvrKRQKiUQqLS0dGRmpra1FIBCXfy9jY2MvLi7O


To decode it, edit message.orig to remove everything except the block of code, and then type base64 -d message.orig message.out. message.out will now contain the decoded message.

uudecode can be used to decode messages which look like this:

begin 644 debian.txt
M:'1T<#HO+VQI<W1S+F1E8FEA;BYO<F<O9&5B:6%N+61E=F5L+S(P,#$O9&5B M:6%N+61E=F5L+3(P,#$Q,B]M<V<P,3DW-RYH=&UL"@H@("TM+2TM+2TM+2TM
[...]
end


Edit message.orig to remove everything before the "begin" and after the "end", then type uudecode message.orig. The decoded message will go into the file given in the "begin" line (debian.txt in this example).

Once you think you've decoded the message, the "file" command may be useful. Typing file message.out will tell you what type of file the computer believes message.out to be. Sometimes it gets the details wrong, but if it says that the file is any sort of text, then you can safely read it without messing up your screen.