At 15:01 11/08/2004 -0700, Richard Gaskin wrote:
Alex Tweedly wrote:Actually, I don't think RR excels at network and internet; it does them OK, but without broader library support it can't be said to excel. (e.g. NNTP, NTP, IMAP, POP3, email header parsers, Mime-type handling, etc.). Any of those could built in RR (perhaps more easily than in many other languages), but until they are supported in the standard package, or in well organized add-ons, RR is still lagging.
People still use Usenet? I thought the spammers drove them all away. ;)
That's one reason you might need a scripting language - to guard against Spam :-)
There's a POP library available -- does it not also handle POP3?
I'm sure it will - but I couldn't find a POP library. (so it's either not in the standard package, or it's not well documented, or it's not in a "well organized add-on").
What specific challenges have you encountered with parsing email headers, and what do you need to do with MIME types?
None - since I didn't find a POP3 library, or an email/mime handling lib I did the project in a different language rather than RR, so didn't have any specific challenges.
How are those handled in other languages?
Can't answer in general, but in Python there's convenient POP3 library, so you do something like
import poplib
MAIL = poplib.POP3("mail.tweedly.net")
MAIL.user("username")
MAIL.pass_("password")messageList = MAIL.uidl()[1]
for msg in messageList:
msgNum, msgUID = msg.split()
MAIL.retr(msgNum)
etc.to handle a particular email, you use the email library import email emailmessage = email.message_from_string(theMessageFromPOP3Above)
and then you can conveniently retrieve the headers
headerValue = emailmessage.get('headername')
and parse them
who, emailAddr = email.Utils.parseaddr(msg.get('from'))
and (in a similar way) you can walk through each part of the message using simple get() and gettype() functions, such as
if p.get_main_type() == "image":
image = p.get_payload(decode=1)
fname = p.get_filename()
which not only extract the name and payload, but decodes it for you, ready to write to a file.
Summary:
I could write any one of these functions in RR/Transcript just by reading the RFCs and putting in some effort.
I could write all of them (adequately, maybe not well) given enough time.
But I have finished the project in question in the time it would take me to read through rfc-2822, far less implement it.
-- Alex.
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
