How to send a plain txt file in a zip file via email in unix? The contents in the txt file should be word wrap.
To wrap the text file you can use
fold (see fold man page)
fold -w 78 -s input.txt > wrapped.txt
will wrap your text to a maximum width of 78 characters. You can then use
zip to compress it
zip wrapped.zip wrapped.txt
and then send it per email with
mail -a wrapped.zip -s "Subject of the mail" firstname.lastname@example.org
(not all versions of mail support the
If your mail don't support -a option, do it with uuencode:
uuencode original_filename attachment_filename | mail -s "subject" email@example.com
for example (it's working in front of my eyes):
uuenconde ~/.netrc mynetrc.txt | mail -s "test" firstname.lastname@example.org
and I see the attachment as mynetrc.txt in the mail.