What are some better options for encoding email attachments than uuencode in a bash script?
I'm referencing my original post in which I was asking a question about argument placement pertaining to $2 $3
etc, and eventually ${@:2}
. It was mentioned that there are better methods to encode email attachments.
Note, I used uname -or
to figure out 2.6.32-400.26.3.el5uek GNU/Linux
.
I used the command within a bash script to attach a file to an email, and have it in a couple other scripts as well. However, a few of our machines do not even support uuencode
, so what are some better options for attaching files to emails than uuencode?
linux shell-script email character-encoding
add a comment |
I'm referencing my original post in which I was asking a question about argument placement pertaining to $2 $3
etc, and eventually ${@:2}
. It was mentioned that there are better methods to encode email attachments.
Note, I used uname -or
to figure out 2.6.32-400.26.3.el5uek GNU/Linux
.
I used the command within a bash script to attach a file to an email, and have it in a couple other scripts as well. However, a few of our machines do not even support uuencode
, so what are some better options for attaching files to emails than uuencode?
linux shell-script email character-encoding
3
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
3
Your implementation ofmail
may include-a
to attach a file, in which case the encoding is handled under the hood for you.
– DopeGhoti
Jul 12 '17 at 20:47
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative touuencode
.
– roaima
Jul 12 '17 at 22:15
add a comment |
I'm referencing my original post in which I was asking a question about argument placement pertaining to $2 $3
etc, and eventually ${@:2}
. It was mentioned that there are better methods to encode email attachments.
Note, I used uname -or
to figure out 2.6.32-400.26.3.el5uek GNU/Linux
.
I used the command within a bash script to attach a file to an email, and have it in a couple other scripts as well. However, a few of our machines do not even support uuencode
, so what are some better options for attaching files to emails than uuencode?
linux shell-script email character-encoding
I'm referencing my original post in which I was asking a question about argument placement pertaining to $2 $3
etc, and eventually ${@:2}
. It was mentioned that there are better methods to encode email attachments.
Note, I used uname -or
to figure out 2.6.32-400.26.3.el5uek GNU/Linux
.
I used the command within a bash script to attach a file to an email, and have it in a couple other scripts as well. However, a few of our machines do not even support uuencode
, so what are some better options for attaching files to emails than uuencode?
linux shell-script email character-encoding
linux shell-script email character-encoding
edited 43 mins ago
Rui F Ribeiro
41.8k1483142
41.8k1483142
asked Jul 12 '17 at 20:36
EmileEmile
9810
9810
3
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
3
Your implementation ofmail
may include-a
to attach a file, in which case the encoding is handled under the hood for you.
– DopeGhoti
Jul 12 '17 at 20:47
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative touuencode
.
– roaima
Jul 12 '17 at 22:15
add a comment |
3
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
3
Your implementation ofmail
may include-a
to attach a file, in which case the encoding is handled under the hood for you.
– DopeGhoti
Jul 12 '17 at 20:47
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative touuencode
.
– roaima
Jul 12 '17 at 22:15
3
3
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
3
3
Your implementation of
mail
may include -a
to attach a file, in which case the encoding is handled under the hood for you.– DopeGhoti
Jul 12 '17 at 20:47
Your implementation of
mail
may include -a
to attach a file, in which case the encoding is handled under the hood for you.– DopeGhoti
Jul 12 '17 at 20:47
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative to
uuencode
.– roaima
Jul 12 '17 at 22:15
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative to
uuencode
.– roaima
Jul 12 '17 at 22:15
add a comment |
4 Answers
4
active
oldest
votes
I prefer using mpack to send attachments as MIME
as in:
mpack -s "message" file email@example.com
Name
mpack - pack a file in MIME format Synopsis
mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] file address ... mpack [ -s subject ] [ -d
descriptionfile ] [ -m maxsize ] [ -c content-type ] -o outputfile
file mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] -n newsgroups file Description
The mpack program encodes the the named file in one or more MIME
messages. The resulting messages are mailed to one or more recipients,
written to a named file or set of files, or posted to a set of
newsgroups.
add a comment |
You know I find that the following works just fine for files in either TEXT or binary:
mailx -s SUBJECT -a FILE1 -a FILE2 ... USERNAME
It basically does the MIME encoding automatically and.....even M$ Outlook does the right thing with such a message.
add a comment |
If missing uuencode
, this perl
hack does pretty much the same thing.
Credit goes to Perl Monks site
perl -ple"BEGIN{ $/=45} $_ = pack 'u', $_" file
The question is about avoiding use ofuuencode
. The back-story is that a MIME-compliant solution is being sought.
– roaima
Jul 12 '17 at 22:12
add a comment |
You could 7z or zip or tar.wz or similar to get a compressed list of files.
Then the compressed list of files could be converted to hex. Use od hd or xxd:
$ xxd -p compressedfile.7z > ToBeMailedFile
Send the file attached to your email.
Convert back the file:
$ xxd -p -r ToBeMailedFile > compressedfile.7z
Expand the file to the list of files.
As HEX pass every web limitation of characters allowed, the file will pass.
As the list of files is compressed before being sent, there is a gain of size.
The compressed file could be also encrypted.
Several diferent tools could be used to process the data. Only the conversion of HEX to BIN needs xxd. So, freedom of tools.
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more foruuencode
and 35% for base64. Demo:i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified thatuuencode
was not available: better options for attaching files to emails than uuencode?
– Arrow
Sep 24 '17 at 3:00
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f378066%2fwhat-are-some-better-options-for-encoding-email-attachments-than-uuencode-in-a-b%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I prefer using mpack to send attachments as MIME
as in:
mpack -s "message" file email@example.com
Name
mpack - pack a file in MIME format Synopsis
mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] file address ... mpack [ -s subject ] [ -d
descriptionfile ] [ -m maxsize ] [ -c content-type ] -o outputfile
file mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] -n newsgroups file Description
The mpack program encodes the the named file in one or more MIME
messages. The resulting messages are mailed to one or more recipients,
written to a named file or set of files, or posted to a set of
newsgroups.
add a comment |
I prefer using mpack to send attachments as MIME
as in:
mpack -s "message" file email@example.com
Name
mpack - pack a file in MIME format Synopsis
mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] file address ... mpack [ -s subject ] [ -d
descriptionfile ] [ -m maxsize ] [ -c content-type ] -o outputfile
file mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] -n newsgroups file Description
The mpack program encodes the the named file in one or more MIME
messages. The resulting messages are mailed to one or more recipients,
written to a named file or set of files, or posted to a set of
newsgroups.
add a comment |
I prefer using mpack to send attachments as MIME
as in:
mpack -s "message" file email@example.com
Name
mpack - pack a file in MIME format Synopsis
mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] file address ... mpack [ -s subject ] [ -d
descriptionfile ] [ -m maxsize ] [ -c content-type ] -o outputfile
file mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] -n newsgroups file Description
The mpack program encodes the the named file in one or more MIME
messages. The resulting messages are mailed to one or more recipients,
written to a named file or set of files, or posted to a set of
newsgroups.
I prefer using mpack to send attachments as MIME
as in:
mpack -s "message" file email@example.com
Name
mpack - pack a file in MIME format Synopsis
mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] file address ... mpack [ -s subject ] [ -d
descriptionfile ] [ -m maxsize ] [ -c content-type ] -o outputfile
file mpack [ -s subject ] [ -d descriptionfile ] [ -m maxsize ] [ -c
content-type ] -n newsgroups file Description
The mpack program encodes the the named file in one or more MIME
messages. The resulting messages are mailed to one or more recipients,
written to a named file or set of files, or posted to a set of
newsgroups.
answered Jul 12 '17 at 21:41
Rui F RibeiroRui F Ribeiro
41.8k1483142
41.8k1483142
add a comment |
add a comment |
You know I find that the following works just fine for files in either TEXT or binary:
mailx -s SUBJECT -a FILE1 -a FILE2 ... USERNAME
It basically does the MIME encoding automatically and.....even M$ Outlook does the right thing with such a message.
add a comment |
You know I find that the following works just fine for files in either TEXT or binary:
mailx -s SUBJECT -a FILE1 -a FILE2 ... USERNAME
It basically does the MIME encoding automatically and.....even M$ Outlook does the right thing with such a message.
add a comment |
You know I find that the following works just fine for files in either TEXT or binary:
mailx -s SUBJECT -a FILE1 -a FILE2 ... USERNAME
It basically does the MIME encoding automatically and.....even M$ Outlook does the right thing with such a message.
You know I find that the following works just fine for files in either TEXT or binary:
mailx -s SUBJECT -a FILE1 -a FILE2 ... USERNAME
It basically does the MIME encoding automatically and.....even M$ Outlook does the right thing with such a message.
answered Jul 12 '17 at 23:28
mdpcmdpc
5,07621838
5,07621838
add a comment |
add a comment |
If missing uuencode
, this perl
hack does pretty much the same thing.
Credit goes to Perl Monks site
perl -ple"BEGIN{ $/=45} $_ = pack 'u', $_" file
The question is about avoiding use ofuuencode
. The back-story is that a MIME-compliant solution is being sought.
– roaima
Jul 12 '17 at 22:12
add a comment |
If missing uuencode
, this perl
hack does pretty much the same thing.
Credit goes to Perl Monks site
perl -ple"BEGIN{ $/=45} $_ = pack 'u', $_" file
The question is about avoiding use ofuuencode
. The back-story is that a MIME-compliant solution is being sought.
– roaima
Jul 12 '17 at 22:12
add a comment |
If missing uuencode
, this perl
hack does pretty much the same thing.
Credit goes to Perl Monks site
perl -ple"BEGIN{ $/=45} $_ = pack 'u', $_" file
If missing uuencode
, this perl
hack does pretty much the same thing.
Credit goes to Perl Monks site
perl -ple"BEGIN{ $/=45} $_ = pack 'u', $_" file
answered Jul 12 '17 at 20:45
stevesteve
14.3k22653
14.3k22653
The question is about avoiding use ofuuencode
. The back-story is that a MIME-compliant solution is being sought.
– roaima
Jul 12 '17 at 22:12
add a comment |
The question is about avoiding use ofuuencode
. The back-story is that a MIME-compliant solution is being sought.
– roaima
Jul 12 '17 at 22:12
The question is about avoiding use of
uuencode
. The back-story is that a MIME-compliant solution is being sought.– roaima
Jul 12 '17 at 22:12
The question is about avoiding use of
uuencode
. The back-story is that a MIME-compliant solution is being sought.– roaima
Jul 12 '17 at 22:12
add a comment |
You could 7z or zip or tar.wz or similar to get a compressed list of files.
Then the compressed list of files could be converted to hex. Use od hd or xxd:
$ xxd -p compressedfile.7z > ToBeMailedFile
Send the file attached to your email.
Convert back the file:
$ xxd -p -r ToBeMailedFile > compressedfile.7z
Expand the file to the list of files.
As HEX pass every web limitation of characters allowed, the file will pass.
As the list of files is compressed before being sent, there is a gain of size.
The compressed file could be also encrypted.
Several diferent tools could be used to process the data. Only the conversion of HEX to BIN needs xxd. So, freedom of tools.
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more foruuencode
and 35% for base64. Demo:i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified thatuuencode
was not available: better options for attaching files to emails than uuencode?
– Arrow
Sep 24 '17 at 3:00
add a comment |
You could 7z or zip or tar.wz or similar to get a compressed list of files.
Then the compressed list of files could be converted to hex. Use od hd or xxd:
$ xxd -p compressedfile.7z > ToBeMailedFile
Send the file attached to your email.
Convert back the file:
$ xxd -p -r ToBeMailedFile > compressedfile.7z
Expand the file to the list of files.
As HEX pass every web limitation of characters allowed, the file will pass.
As the list of files is compressed before being sent, there is a gain of size.
The compressed file could be also encrypted.
Several diferent tools could be used to process the data. Only the conversion of HEX to BIN needs xxd. So, freedom of tools.
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more foruuencode
and 35% for base64. Demo:i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified thatuuencode
was not available: better options for attaching files to emails than uuencode?
– Arrow
Sep 24 '17 at 3:00
add a comment |
You could 7z or zip or tar.wz or similar to get a compressed list of files.
Then the compressed list of files could be converted to hex. Use od hd or xxd:
$ xxd -p compressedfile.7z > ToBeMailedFile
Send the file attached to your email.
Convert back the file:
$ xxd -p -r ToBeMailedFile > compressedfile.7z
Expand the file to the list of files.
As HEX pass every web limitation of characters allowed, the file will pass.
As the list of files is compressed before being sent, there is a gain of size.
The compressed file could be also encrypted.
Several diferent tools could be used to process the data. Only the conversion of HEX to BIN needs xxd. So, freedom of tools.
You could 7z or zip or tar.wz or similar to get a compressed list of files.
Then the compressed list of files could be converted to hex. Use od hd or xxd:
$ xxd -p compressedfile.7z > ToBeMailedFile
Send the file attached to your email.
Convert back the file:
$ xxd -p -r ToBeMailedFile > compressedfile.7z
Expand the file to the list of files.
As HEX pass every web limitation of characters allowed, the file will pass.
As the list of files is compressed before being sent, there is a gain of size.
The compressed file could be also encrypted.
Several diferent tools could be used to process the data. Only the conversion of HEX to BIN needs xxd. So, freedom of tools.
answered Jul 13 '17 at 0:02
ArrowArrow
2,490218
2,490218
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more foruuencode
and 35% for base64. Demo:i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified thatuuencode
was not available: better options for attaching files to emails than uuencode?
– Arrow
Sep 24 '17 at 3:00
add a comment |
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more foruuencode
and 35% for base64. Demo:i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified thatuuencode
was not available: better options for attaching files to emails than uuencode?
– Arrow
Sep 24 '17 at 3:00
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more for uuencode
and 35% for base64. Demo: i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
xxd
is less efficient; it requires 103% more space than the input, vs only 37% more for uuencode
and 35% for base64. Demo: i=/bin/dash o=/dev/stdout ; wc -c $i <(uuencode $i $o) <(uuencode -m $i $o) <(xxd -p $i) | head -n -1
– agc
Sep 23 '17 at 7:33
@agc You may be correct; however: The question specified that
uuencode
was not available: better options for attaching files to emails than uuencode?– Arrow
Sep 24 '17 at 3:00
@agc You may be correct; however: The question specified that
uuencode
was not available: better options for attaching files to emails than uuencode?– Arrow
Sep 24 '17 at 3:00
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f378066%2fwhat-are-some-better-options-for-encoding-email-attachments-than-uuencode-in-a-b%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
MIME (base64) encoding is used for this purpose.
– Thomas Dickey
Jul 12 '17 at 20:38
3
Your implementation of
mail
may include-a
to attach a file, in which case the encoding is handled under the hood for you.– DopeGhoti
Jul 12 '17 at 20:47
Possible duplicate of how to send multiple attachment in 1 email using uuencode, which actually offers a MIME-based alternative to
uuencode
.– roaima
Jul 12 '17 at 22:15