rfc2822

Forcing "+0000" timezone for RFC2822 times in Ruby

How can I force the Time.rfc2822 function to spit out +0000? Ruby lets me parse RFC2822 formatted times pretty easily: require 'time' time = Time.parse('14 Aug 2009 09:28:32 +0000') puts time => "2009-08-14 05:28:32 -0400" But what about displaying times? Notice that the time it parsed is a local time. No worries, I can convert it ...

Parsing RFC 2822 date in JAVA

I need to parse an RFC 2822 string representation of a date in Java. An example string is here: Sat, 13 Mar 2010 11:29:05 -0800 It looks pretty nasty so I wanted to make sure I was doing everything right and would run into weird problems later with the date being interpreted wrong either through AM-PM/Military time problems, UTC t...

How to add a message as an attachment on another message with javax.mail

Hello. I've got a mailer daemon that check a box and fetch the mails inside every X mins. When an error occurs, I need to send a alert mail, with the faulty message as an attachment. I dont want to create a file, write the content from the original message and then add the file to the error message, I want to directly set the MimeBodyP...

Convert Python datetime to rfc 2822

I want to convert a Python datetime to a an RFC 2822 datetime. I've tried these methods to no avail: >>> from email.Utils import formatdate >>> import datetime >>> formatdate(datetime.datetime.now()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.6...

regex to validate a message-ID as per RFC2822

I have not found a regexp to do this. I need to validate the "Message-ID:" value from an email. It is similar to a email address validation regexp but much simpler, without most of the edge cases the email address allows, from rfc2822 msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS] id-left = dot-atom-te...