Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

catching the error with 'import-email?

 [1/8] from: petr:krenzelok:trz:cz at: 4-Dec-2001 8:09


Hi, shouldn't mezzanine functions as import-email be catchable automatically by something like: if error? try [msg: import-email data] .... ? my script returned something like: [[root--moon] smrsh]# ls -l | ./snih.r ** Throw Error: ** User Error: header not correctly parsed ** Near: throw make error! info Thanks, -pekr-

 [2/8] from: jon_saltzman::pitzer::edu at: 4-Dec-2001 0:01


Hi Petr, I am working on a mail client which has a function just like this, and I've had no trouble with it on a Windows client - here's my code: <snippet> mail: open pop://user:[pass--server] if error? try [msg: import-email pick mail 1] [ print "Error" ] </snippet> This produces:
>> mail: open pop://user:[pass--server] >> if error? try [msg: import-email pick mail 1] [ print "Error" ]
== none Hope that helps! -Jon

 [3/8] from: petr:krenzelok:trz:cz at: 4-Dec-2001 9:03


Jon Saltzman wrote:
> Hi Petr, > I am working on a mail client which has a function just like this, and
<<quoted lines omitted: 7>>
> >> if error? try [msg: import-email pick mail 1] [ print "Error" ] > == none
Well, I can understand it. However - I piped ls -l linux command to the script and it failed returning throw error. .... But maybe the problem was with copy .... the strange thing is, that Rebol doesn't preserve port data, once 'copy on port is used, while it does so, once read-io is used. Strange thing, as we were suggested to not use read-io anymore ... Holger? -pekr-

 [4/8] from: petr:krenzelok:trz:cz at: 4-Dec-2001 9:25


Heh, look at following code result! ->> ble: import-email {total 2 { -rwxr-xr-x 1 root root 253 Dec 4 07:13 process-email.r { -rwxr-xr-x 1 root root 426 Dec 4 08:43 snih.r { } ->> ble ->> probe ble make object! [ To: none CC: none BCC: none From: none Reply-To: none Date: none Subject: none Return-Path: none Organization: none Message-Id: none Comment: none X-REBOL: "1.2.1.3.1 http://WWW.REBOL.COM" MIME-Version: none Content-Type: none Content: "" ] ->> How's that above input string was correctly parsed as an email? Huh? How should I be sure I received proper email message? 2) {From [Petr--Krenzelok--trz--cz] Tue Dec 4 08:49:35 2001 Received: from atlanta.trz.cz (oko2.trz.cz [195.47.26.3]) ^-by moon.moravia-steel.cz (8.11.6/8.11.6) with ESMTP id fB47nZr26447 ^-for <[snih--rebol--cz]>; Tue, 4 Dec 2001 08:49:35 +0100 Received: from ironman.trz.cz (IDENT:[0--ironman--trz--cz] [195.47.26.29]) ^-by atlanta.trz.cz (8.11.0/8.11.0) with ESMTP id fB48GiV25598 ^-for <[snih--rebol--cz]>; Tue, 4 Dec 2001 09:16:44 +0100 Received: from trz.cz ([172.25.7.73]) ^-by ironman.trz.cz (8.11.6/8.11.6) with ESMTP id fB48NaM05615 ^-for <[snih--rebol--cz]>; Tue, 4 Dec 2001 09:23:36 +0100 Message-ID: <[3C0C85AF--3F32CAAE--trz--cz]> Date: Tue, 04 Dec 2001 09:13:35 +0100 From: Petr Krenzelok <[Petr--Krenzelok--trz--cz]> Reply-To: [Petr--Krenzelok--trz--cz] X-Mailer: Mozilla 4.73 [en] (Win95; I) X-Accept-Language: cs,en MIME-Version: 1.0 To: [snih--rebol--cz] Subject: just a try ... Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit short message, actually - very short one .... -pekr- } make object! [ To: none CC: none BCC: none From: none Reply-To: none Date: none Subject: none Return-Path: none Organization: none Message-Id: none Comment: none X-REBOL: "2.0.0.4.2 http://WWW.REBOL.COM" MIME-Version: none Content-Type: none Content: {short message, actually - very short one .... -pekr- } ] incorrectly parsed - why? Only 'content field seems to be filled-in .... -pekr-

 [5/8] from: petr:krenzelok:trz:cz at: 4-Dec-2001 14:00


Petr Krenzelok wrote:
> Jon Saltzman wrote: > > Hi Petr,
<<quoted lines omitted: 17>>
> read-io is used. Strange thing, as we were suggested to not use read-io > anymore ... Holger?
commenting myself :-) Once I write data manually to mailbox file, and then read it back using 'pop protocol, 'import-email works. What is the difference? Looking at pop scheme, I can't find out, what is the difference, as we are talking the same string :-) Well, as Rebol doesn't support locking files, it is very dangerous for me to work directly with mailbox file, as 'remove on pop port could corrupt the file, if another Rebol process would try to append new email at the end ... or so I think ... -pekr-

 [6/8] from: mario:cassani:icl at: 4-Dec-2001 14:28


Hi Pekr,
> commenting myself :-) Once I write data manually to mailbox > file, and then read it
<<quoted lines omitted: 10>>
> end ... or so I think > ...
I am actually working on a mailer and, to test without nagging the pop3 server, I use: fake-email: import-email read %message####.txt where message####.txt is a file used to "store" the full mail message as it was on the pop3 server: box: open pop://user:[passwd--pop--server--net] msgnumb: 1 while [not tail? box] [ msgfull: first box ; ****** You don't need this ; msg: import-email msgfull write to-file rejoin ["message" msgnumb ".txt"] msgfull box: next box msgnumb: msgnumb + 1 ] or, even better, you can copy the mailbox in its actual state (untested): box: open pop://user:[passwd--pop--server--net] while [not tail? box] [ msgfull: first box write/append %mailbox.txt msgfull box: next box ] Hope this helps Mario Cassani

 [7/8] from: ingo:2b1 at: 4-Dec-2001 15:30


Hi Petr, Once upon a time Petr Krenzelok spoketh thus: <..>
> How's that above input string was correctly parsed as an email? Huh? How > should I be sure I received proper email message?
That's a mystery to me ...
> 2) > {From [Petr--Krenzelok--trz--cz] Tue Dec 4 08:49:35 2001 > Received: from atlanta.trz.cz (oko2.trz.cz [195.47.26.3])
<..>
> incorrectly parsed - why? Only 'content field seems to be filled-in ....
I _think_ that the first line o this outout is part of the mbox format, and not of the email format, and thus isn't handled by import-email. If you'd start importing with the second line, all should work well. I hope that helps. Ingo

 [8/8] from: petr:krenzelok:trz:cz at: 4-Dec-2001 15:38


Well, the problem is - I don't want to store message as-is for post-processing purposes. My email never reaches its mailbox. I want to handle it directly upon its delivery. I found the problem - it is first line "FROM ...." string, which causes problem to 'import-email .... I solved it by following line: remove/part find msg-str newline remove msg-str thanks anyway .... Cheers, -pekr-

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted