Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Attachments with text and graphic via sendmail

Status
Not open for further replies.

lordblood

Programmer
Nov 9, 2001
35
0
0
US
Can someone please tell me what I am doing wrong? I am trying to send an email with an attachment via shell script. The following is the finalized output. Basically it’s just a sentence and a gif attachment. The sentence appears fine when receiving the email but the attachment is always 0 bytes (receiving email-using outlook). I received this 'skeleton' from another person who says it works; however, I'm unable to get it working.

I am able to send text only mail as well as graphic only using:
Code:
uuencode w.gif w.gif | /usr/lib/sendmail someone@somewhere.com
for the graphic.

I'm not familiar with sendmail so any help would be greatly appreciated.

Lord Blood


Code:
MIME-Version: 1.0
TO: someone@somewhere.com
FROM: someone@somewhereelse.com
SUBJECT: attachment try
Content-Type: multipart/mixed; boundary=boundarystring
--boundarystring
Content-Type: text/plain;

attachment is a logo.

--boundarystring
Content-Type: application/octet-stream; name="w.gif"; type=binary
Content-Disposition: attachment; filename="w.gif"
Content-Transfer-Encoding: X-uuencode
begin 644 w.gif
M1TE&.#EAR !, /<  -/3T_K.!=O;V\S,S(RO[OGY^;2/ AF=(,+&quot;PM&quot;VL^V#
M=-:J @XUB:L4 A=1S$=WX&A5#]3NU6N6[%VA7F4,!-OE^ <F:/[^_J[%\+RMO.)+-J;=J6?2;;*YRK6:DO7U]822LAA*MM(H$>SP^C-EU/#Q\>[N[_5H5'6'
MK8AM K2SLRY9M8T. 4?&quot;3I>6E>FZ!,C!N_S\_&Z,S[6GE5N+ZN7M]_EW9/OL
MZ:RKK&quot;M-E>CHZ/SR[//Y_2-:T 1R&quot;;*LJ!A%IP%3 ;S&quot;R,,9 ^;FYNFSJ_K:
MU7FD\%!NK]_?W]C=XO24A^;CVEMLD_7/)_O&quot;N<78^/?JDY6JV)!:4Y&(=='+
MR$93<J.BHIBAM'5]A?_\;L[2V DZH]71S*2JN(=I9=$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+574&@0TW9V;;5@ZAL'0)APQI0' +P0O6AWW2H 2PER(H< ULIQD/0&B$
M\RU5DG'E=U$'AGXLP )7\%%?94YJ-'<2L7VTE2)8@ T=J!&quot;.( /+( ,R@ (H
MX E2P ^!U5(Y4!G7PG,#&quot;%0V]0>7HA#2@&W*M%=]@@T.V'1:UQ!1\'AUMF&quot;&
MY@FZY!>RY&quot;('<00]4#.T<FLD6&UOA V3H $CEX)?L 5)8&quot;2LEW0.@8&TQ4OT
MT K'AWE'(@VU,&quot;*:( ,/,#L'<T_/L A 0WPL$(<%_[80-W!S>K586D8'?&quot;9L
M<]!K&quot;9&%10<!G&5H28 $?]$77+&quot;''E,0&# HC- 'H-9@GA=I+Z( LP94XE1S
M&&quot;,#@5$5?=$> 18Q7A0?]20#?$ 5A^19.((/ SA-M3A]!\AD<3!O0$($P_!K
M4Y1PQ\&quot;$U#40G/AB=J9L9R(-XT />,$)G, %*S + >4Q-? _>H$H9[@PK\A6
MD% $;094*@:#&;$%#545L<<)'7 (,64;2\(LY%&quot;0_# 5S_9&quot;)#.&quot;:O!3*>@!
M@-80R:<!:[!7A7-K3$!:[K4-.'9Y&quot;U%]&quot;U!GF5 O2%(+N= $IF9J7! &quot;RT  
M[,!:?! KSI$P(T@0\;A;8?] 4B457I;U$<3@A581E)^Q!:=H,@6B#TAI L=6
M<8AT48L@0B6E7!&7$!@4A96 *##E![303]NP#7,0D0MA!Z107A!P7B+X)R9 
M+OWP&quot;XS &quot;)P0 GP@ =KR@5JE&quot;8UE'JASDX]H7,*322QP&quot;BOF$7; !+D4E%91
MBDE@$:SU@8>D K#& PW9ET#U ^Z7$,!3D13@#^,7+GIP!J+C3]OP!G_0AP/Q
M&quot;6SP B\VDA7DD?K0&quot;I_F#Y'0#UX@A,/&quot; -$V)#59$'J9)D_Y4YGD1]GX?FFP
M EAAF-^@&quot;W]0$8O)E*7G(*T0!PV 24&quot;E&quot;(.4$,F'<Q.VD-@R IW0.9U#58@ 
M%@K_47WF96?-P&'X0&quot;[)  VH, =8\ !3P4OWI3 QM9MDHP;1Z9O V1$$X@;[
M89@A\ TK< M%&9P#L9P'TYQQ\0P)L :9]*&quot;5Y4XY4PRR:&97>9[5:0?6( _>
M:0 >*EX)\0D!0&?G]8ZAE2]- @.>4$ ]P$LY4&quot;V:F(:<T@CR2 WCH@CY^5.N
M$ 82FC.+8 02 3U>D .C&)38<3L102J&quot;U90.LB8>L H/^ILW.!#>8V839J(#
M80);\ 8>VJ73H <]6IJ;DP*9@&4D&9#>\3)&quot;P#KK5HII0 R+% $'0D'VX T0
M4P(P )V9I$XBH #YT($W4 2N8#D3<0]ZX 7BR E]8:0D_X&quot;.$'%_W$ HR49_
MU9&quot;63YJ&quot;#^H*^6 0- 1A@_!DS:&quot;=MZ*A:? &7>FEG=&quot;!F>,$=&8+.&quot; ,YTFI
M:E( )K Z6G05 UJ@!;$!1^$#O,$*]<&quot;$9( M:U((SQBEEY0\DZ  2Z  KN&quot;@
M<M 3^+@0.M L39 BBKJHDB ))&quot; VZ=@_^_&quot;!DCJI35BMT# %JX&quot;I#; &DS &
M15 $PN=SJV ,&\(W3W<O[I $:7 ,P-&quot;5VV  >' &M, +\! %90 _P.!I[.F8
MUV*@_W +5&&<W# +&quot;#$/2,$;&quot;1($ONH#B8!N:;D)4Y&quot;&quot;ZKJG#KD*B, #)E&quot;'
M^-(.S=(/EI&quot;2V6H5DM #?&quot; #!/^  5&quot;0-5FS#XMY%RJR(E9 'K+Z >E #K%P
M#%,P&quot;&quot;++ E': '$@!C! &quot;.3V66J3EFF  U0 #&quot;G@KP#[G?&#&quot;/LD8O29.C4Q
M&quot;[KP#8MZ%=_@&quot;7.W 1,P :S0&quot;'(KMZS &quot;N_0L''1FD( &quot;.>PM'YK4F)0)O23
MFRM+/M)A&quot;8P L]D*&($Q&(*QK6A+#TV0!9'@#V;JC1-*!&quot;CG!LT &quot;%\P!5-P
M&quot;L8@!A[ 3&<G5\$TE2>JKZ\ &quot;RY !<B #&_P!JF &quot;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V  MB:K:WA.K$#O)^! DVT5&quot;B%V)A--FW2#$V0
M PR %XR[K9+P#<4[P<B!4/*!EYF]VK?,NLV0P?1 #RLPVRN@&quot;P+D&quot;?#;Q1YU
M;F;-VBT-/4TBPO/+-T6L&quot;<8]24T%S[Y]UFO2&quot;N-@QW><(7/PRO=D)M^\W,S=
M,(NL4%0LR_@E!,S8'=YUM23M\#+F/<V[7-?AO=X&quot;Q=[N_=[P'=_R/=_T+=\!
# 0 [
 
end
--boundarystring--
 
uuencode w.gif w.gif | mail someone@somewhere.com

might be more appropriate. sendmail says in it's docs that you shouldn't in general call it directly.

if you want to send lots of attachments and text with them, you might be better off looking for 'mpack' on the web for MIME packing and encoding emails.
 
Maybe a late answer, but here it is ...

In MIME, there is a header section and a body, both preceded by the boundary string identifier. (in your case --boundaryString).

The space between the header and body is REQUIRED. So, if you change

SUBJECT: attachment try
Content-Type: multipart/mixed; boundary=boundarystring
--boundarystring
Content-Type: text/plain;
to
SUBJECT: attachment try
Content-Type: multipart/mixed; boundary=boundarystring
--boundarystring

Content-Type: text/plain;

AND

Content-Transfer-Encoding: X-uuencode
begin 644 w.gif
M1TE&.#EAR !, /< -/3T_K.!=O;V\S,S(RO[OGY^;2/ AF=(,+&quot;PM&quot;VL^V#
to
Content-Transfer-Encoding: X-uuencode

begin 644 w.gif
M1TE&.#EAR !, /< -/3T_K.!=O;V\S,S(RO[OGY^;2/ AF=(,+&quot;PM&quot;VL^V#

etc, it will work.

I am getting the attachment now(non-zero bytes), but still can't open it. A step closer ...




 
I don't know if this matches your system but on a Unix AIX using SENDMAIL from an application process we have 2 steps in creating the attachement and mailing.
A.
create a email body & header as a text file, then add the attachement using the uuencode command as thus.
&quot;uuencode attach_1 attach_2 >> emailbodyfile&quot;

B.
then send the file.
&quot;sendmail -faddress -t < emailbodyfile&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top