我正在尝试通过电子邮件发送名称中包含冒号 (:) 字符的文件:
my_attachment_name=some_file_with_:_in_the_name.txt
uuencode "${my_attachment_name}" "`basename \"${my_attachment_name}\"`"
| mail -s "My Report ..." my_email@xyz.com
但是,当我收到电子邮件时,我看到“:”已从文件名中删除。
some_file_with__in_the_name.txt
我该如何解决?
谢谢。
最佳答案
您可以尝试将 uuencode 与“--encode-file-name”一起使用。但是,在这里,我看到:
$ uuencode foo:bar.txt foo:bar.txt
begin 664 foo:bar.txt
#:&D*
`
end
这正是我想要的“开始”行。
对比:
$ uuencode --encode-file-name foo:bar.txt foo:bar.txt
begin-encoded 664 Zm9vOmJhci50eHQ=
#:&D*
`
end
uudecode 不需要任何选项就可以在我的计算机上从 Zm9vOmJhci50eHQ= 重建 foo:bar.txt。
还要检查您电子邮件的原始内容,电子邮件客户端可能是愚蠢的。例如,DOS 偏见可能会使电子邮件客户端放弃冒号。
关于Linux:为什么在使用 uuencode 时从文件名中删除冒号 (:)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31934288/