I am trying to send an attachment file with the mcmail.mc file. So far, this
is what I have done:
I put a field "theAttachment" into the card. The script is from the button
"Send", with my addition clearly marked.
It does something, but it doesn't place it as an attachment, but as a part
of the body text.
# construct email header
put "" into mailraw
put "From: "& fld "mailfrom" & crlf after mailraw
put "Date: "& mimedate() & crlf after mailraw
put "Content-Type: text/plain; charset=us-ascii"& crlf after mailraw
put "MIME-Version: 1.0"& crlf after mailraw
put "Message-Id: <"& the seconds &"-"& the ticks &"@MetaCardSMTP>" & crlf
after mailraw
put "To: "& fld "to" & crlf after mailraw
if fld "cc" <> "" then
put "CC: "& fld "cc" & crlf after mailraw
end if
put "Subject: "& fld "subject" & crlf after mailraw
put crlf & fld "body" after mailraw
-- ** MY ADDITION
if fld "theAttachment" is not empty then
put fld "theAttachment" into theAttachmentName
put "binfile:" & theAttachmentName into theattachment
put crlf & "Content-Type: application/base64; name=" & quote &
theattachment & quote after mailraw
put crlf & crlf & base64Encode(url theAttachment) after mailraw
end if
--
# socket implementation, talking to smtp
smtpsend fld "smtpserver",fld "mailfrom",validEmailList,mailraw
end composemail
--------------
I sent the file (a MetaCard file) to myself. I copied and pasted the encoded
data in my email into a MC field. A button has the following script:
on mouseUp
ask file "What file to save to?"
put it into thefileName
put base64Decode(field "thebinfile") into URL thefileName
end mouseUp
But now, when I attempt to open the file (type into the message box "Answer
file "?"; open it), I get the message "stack was corrupted by a non-binary
file transfer"
-------------
So, any suggestions? I really *need* to be able to send file attachments
with this MCmail protocol. I am building an app that will generate a MC
stack, then email it to the appropriate person.
Thanks for your help,
Raymond
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.