[REBOL] Re: File writing issue
From: antonr:iinet:au at: 5-Nov-2003 17:43
Just a few notes on the multiple appends for now;
> messaging server:
> ;compose the MIME formatted message
> m: ""
> 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"
> close smtp
You can join them all together with rejoin:
m: copy "" ; copy ensures it a fresh new empty string
append m rejoin [
"HELO^/"
"MAIL FROM:<" return_email ">^/"
"RCPT TO:<" user_email ">^/"
"DATA^/"
; ... etc.
]
Also this could be rewritten to add your newlines for you
won't save you much code in this case, though:
foreach line reduce [
"HELO"
rejoin ["MAIL FROM:<" return_email ">"]
rejoin ["RCPT TO:<" user_email ">"]
"DATA"
; ... etc.
][append m join line newline]
Anton.