Title: sockets - sending email attachments
I have merged  two sockets email scripts I after looking
through the archives. I can get Andu's file attachment scripting
to work fine except for attachments over 250k (approx) in size.
Smaller attachments are sent just fine.

I'm posting the header & attachment part of the script below
hoping that someone can provide a clue (better yet a fix!)
so it will send larger file attachments.

Regards,

sims

****************

 # construct email header
  put "" into mailraw
  put "From: "& fld "yourname" & crlf after mailraw
  put "Date: "& mimedate() & crlf after mailraw
  put "MIME-Version: 1.0"& crlf after mailraw
put "Content-Type: multipart/mixed;" & cr after mailraw
put "_____||-" & "2537" & random(1000) & "-||_____" into tSpace ##attachment delimiter##
      put " boundary="& quote & tSpace & quote & cr after mailraw
      put "message-Id: <"& the seconds &"-"& the ticks &"@simcor>" & crlf after mailraw
put "To: " & word 1 of line i of fld "addressName"  & crlf after mailraw
put "Subject: "& fld "subjectName" & crlf after mailraw
put "--"& tSpace & cr after mailraw
put "Content-Type: text/plain; charset=us-ascii"& crlf after mailraw
put crlf & tBodyText & cr & cr & crlf after mailraw
if fld "attachments" is empty
then
  else
  put "--"& tSpace & cr after mailraw
put "Content-Type: application/octet-stream; name="& quote & line 1 of\
           fld "attachments"  & cr after mailraw
  put "Content-Transfer-Encoding: base64" & cr after mailraw
    put "Content-Disposition: attachment; filename=" & quote & line 1 of \
        fld "attachments"  & quote & cr & cr  after mailraw
put line 1 of fld "attachments"  into tAttach
        put line 1 of the u_Attach of this stack  into tAttach
      put  base64Encode(url tAttach) & cr & cr after mailraw
  end if

Reply via email to