[REBOL] Re: File writing issue
From: mattsmac:hot:mail at: 3-Nov-2003 10:04
Sorry for the lack of clarity. Basically, I am implementing a secure
messaging system. This system has 3 components: client software, a
messaging server, and a file server. The messaging server handles most of
the database access of storing and retrieving the messages. The file server
is only for sending and recieving files that users want to send with the
messages. These files are stored on a local drive on the server computer.
This system will be used inside and outside of our company's network. When
used internally, rather than making the users use the client software, I am
sending emails to our exchange server to deliver the messages via Outlook.
So basically what is happening is that once the message is submitted by the
user (external) the message needs to be immediately emailed to the intended
internal user. A temporary solution I'm using is to give internal users
shared access to the servers file store and just insert links to that
location in their emails rather than actually attaching the file. I control
the server, and all machines are windows based machines.
Here is some code
insert port encrypt read/binary/direct fpath
insert port "done"
fpath is the client path to the file on the client computer
make-dir to-file dir
file: rejoin [dir fname]
replace/all file " " "_"
write/binary/direct to-file file decrypt read/binary/direct %temp.dat
where %temp.dat is an encrypted version of the file - the decrypt function
works fine, the file stores fine. dir is the location on the server's drive
to store the file.
;compose the MIME formatted message
append m "EHLO^/"
append m rejoin ["MAIL FROM:<" return_email ">^/"]
append m rejoin ["RCPT TO:<" user_email ">^/"]
append m "DATA^/"
append m "MIME-Version: 1.0^/"
append m "Content-Type: multipart/mixed; boundary=unique-boundary-1^/"
append m rejoin ["Subject: " subj "^/"]
append m "X-MS-Has-Attach: yes^/"
append m rejoin ["Date: " tstamp "^/"]
append m rejoin ["From: <" return_email "^/"]
append m rejoin ["To: <" user_email ">^/"]
append m build-attach-body message files "--unique-boundary-1"
smtp: open/lines tcp://10.10.1.8:25
insert smtp m
insert smtp "."
insert smtp "QUIT"
it is at this point that i normally get the error that the specified file
cannot be opened, but when I go to the location on the drive, it is there
and I can open it manually to verify the contents. If this problem can't be
solved it's not a huge problem because for most purposes, the work-around I
have going now is sufficient. It just seems like this should not happen.
Thanks to you both,
Right, you're not being terribly clear
what you are trying to do. Please explain
the system you want to implement.
What kind of machines are you using and have control over?
Do you control the server?
Let's also see the code.
This sounds like it should be really easy.
By the way, read and write is used in all the
network protocols, including FTP.