sending email in linux as subject and attachment

坚强是说给别人听的谎言 提交于 2019-12-11 06:13:20

问题


  1. I have a file that is about 10 columns wide and try to send it as body. mailx fails sending it as body and sends it as a ATT00001.bin file and as an attachment.

    mail -s "Subject" emailaddress < file.tsv

    Is there way to solve this.

  2. When I try to send it as an attachment, using uuencode

    echo "body" | uuencode inputattachment.tsv attachment.tsv) | mailx -s "subject" emailaddress

    I get an email with text that is encoded and looks like this:

begin 644 report7.tsv
M1&%T92`@("!3=&%T=7,@(#XS,"5V;VP@/C$P)75M("!T;W1A;"UL;V=S("`@
M("`@=6TE+6QO9W,@("`@("`@('1O=&%L+71R86YS("`@("!U;24M=')A;G,@
M("`@("`@=&]T86PM-2XR+C`@("`@('5M)2TU+C(N,"`@("`@("!T;W1A;"TU
M+C$N,"`@("`@=6TE+34N,2XP("`@("`@('1O=&%L+34N,"XP("`@("!U;24M
M-2XP+C`@("`@("`@=&]T86PM-"XR+C`@("`@('5M)2TT+C(N,"`@("`@("!T
M;W1A;"TT+C$N,2`@("`@=6TE+30N,2XQ("`@("`@('1O=&%L+30N,"XP("`@
M("!U;24M-"XP+C`@("`@("`@=&]T86PM=6YK;F]W;B`@('5M)2UU;FMN;W=N
M"C(P,30P,C(P"4-O;7!L971E9`E;)S4N,BXP)UT)6R=L;V<G+"`G=')A;G,G
M+"`G-2XR+C`G+"`G-2XQ+C`G+"`G-2XP+C`G70DQ,SDR-C4)-#4P+C`Y"3(Y
M,S@X-0DQ,#(W+C<).#<),"XP"3(W,C0S,0DU.#DN,3(),SDT.`DQ+C$S"3`)
M,"XP"3`),"XP"3`),"XP"3`),"XP#0HR,#$T,#(R,0E7:6YD;W<)6R=L;V<G
M+"`G=')A;G,G+"`G-2XQ+C`G+"`G-"XR+C`G70E;)VQO9R<L("=T<F%N<`

How do I solve 1 and 2? Does this have anything to do with MS outlook? I will need to do something that MS Outlook supports.


回答1:


There are at least a couple of programs that you can use to send a message with attachments:

  1. The mailx program on my Linux system has a -a option for attaching files as MIME parts:

    echo Test body | mail -s "Test subject" -a test.txt test@example.com
    
  2. Mutt will also do this:

    echo Test body | mutt -s "Test subject" -a test.txt -- test@example.com
    


来源:https://stackoverflow.com/questions/22235505/sending-email-in-linux-as-subject-and-attachment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!