rfc822

Stumped on C# DateTime ToString() formatting problem

空扰寡人 提交于 2019-12-22 01:31:24
问题 I am getting some junk data returned from a ToString() call on a DateTime object in C# and I'm afraid I'm stumped after poking around with it for a while. The function is supposed to format dates to be compliant with RFC 822 (as required by the RSS spec) and looks like: public static string FormatPubDate(DateTime pubDate) { string _rfc822Format = "ddd, dd MMM yyyy HH:mm:ss"; string _tmp = pubDate.ToUniversalTime().ToString(_rfc822Format); return pubDate.ToString(_tmp + " UT"); } Which should

How do you extract multiple email addresses from an RFC 2822 mail header in python?

风流意气都作罢 提交于 2019-12-20 02:15:58
问题 Python's email module is great for parsing headers. However, the To: header can have multiple recipients, and there may be multiple To: headers. So how do I split out each of the email addresses? I can't split on the comma, since the comma can be quoted. Is there a way to do this? Demo code: msg="""To: user1@company1.com, "User Two" <user2@company2.com", "Three, User <user3@company3.com> From: anotheruser@user.com Subject: This is a subject This is the message. """ import email msg822 = email

trying to reply to an existing email with gmail API

↘锁芯ラ 提交于 2019-12-11 07:04:08
问题 I'm trying to reply to an existing email with Gmail API: Since I don't have in the existing mail that i want to reply to the headers of References, In-Reply-To then i'm using the Message-ID instead to fill what I'm sending DB5PR03MB1206D3A24F124BDF43A5C6E683D60@DB5PR03MB1206.eurprd03.prod.outlook.com is the Message-ID header of existing mail. I've created the following RFC-802: Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit References:

DateTime to RFC-1123 gives inaccurate timezone

烂漫一生 提交于 2019-12-10 18:59:49
问题 If I get the RFC-1123 formatted date of a DateTime object, it gives the current local time, but gives the timezone as GMT (which is inaccurate). DateTime.Now.ToString("r"); returns Fri, 12 Feb 2010 16:23:03 GMT At 4:23 in the afternoon, but my timezone is UTC+10 (plus, we're currently observing daylight saving time). Now, I can get a return value that's "correct" by converting to UTC first: DateTime.UtcNow.ToString("r"); returns Fri, 12 Feb 2010 05:23:03 GMT However, ideally, I'd like to get

How to stop HTTP (and rfc822, email) header injection?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 00:03:22
问题 (I am asking this question (and answering it), to make accessible some (hopefully useful) information, since I could not find this readily using search engines. However, feel free to answer it and add useful information :-).) How can HTTP headers be escaped/quoted in Python? And/Or how can they be validated to make sure they do not contain any context-escaping values? In other words, how can we do for HTTP headers, what cgi.escape and urllib.quote methods (and sanitizing) do for HTML and URLs

Is there a “no-reply” email header?

只愿长相守 提交于 2019-12-09 15:08:23
问题 I often see automated emails postfixed with a message like Amazon: *Please note: this e-mail was sent from an address that cannot accept incoming e-mail. Please use the link above if you need to contact us again about this same issue. Twitter: Please do not reply to this message; it was sent from an unmonitored email address. This message is a service email related to your use of Twitter. Google Checkout: Need help? Visit the Google Checkout help center. Please do not reply to this message.

Parsing an RFC822-Datetime in .NETMF 4.0

半世苍凉 提交于 2019-12-05 16:40:05
I have an application written in .NETMF that requires that I be able to parse an RFC822-Datetime. Normally, this would be easy, but NETMF does not have a DateTime.parse() method, nor does it have some sort of a pattern matching implementation, so I'm pretty much stuck. Any ideas? EDIT: "Intelligent" solutions are probably needed. Part of the reason this is difficult is that the datetime in question has a tendency to have extra spaces in it (but only sometimes). A simple substring solution might work one day, but fail the next when the datetime has an extra space somewhere between the parts. I

RFC822 Timezone Parsing in Java

时光怂恿深爱的人放手 提交于 2019-12-05 03:05:35
I have a JS date that is being converted by Dojo into RFC822 format. The function call - dojo.date.toRfc3339(jsDate), generates the following date - 2007-02-26T20:15:00+02:00. I have an application that uses a Java date SimpleDateFormat to parse in the dates generated above. I am having problems parsing this date format due to the timezone. I have attempted to use yyyy-mm-DD'T'hh:mm:ssZ This fails as the 'Z' for timezone doesn't expect a ':' character. Does anyone know how I would specify a pattern to handle a RFC822 date with the ':'? revision: Thanks for correctly interpreting what I am

How to stop HTTP (and rfc822, email) header injection?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 18:23:04
(I am asking this question (and answering it), to make accessible some (hopefully useful) information, since I could not find this readily using search engines. However, feel free to answer it and add useful information :-).) How can HTTP headers be escaped/quoted in Python? And/Or how can they be validated to make sure they do not contain any context-escaping values? In other words, how can we do for HTTP headers, what cgi.escape and urllib.quote methods (and sanitizing) do for HTML and URLs? This can be used to guard against HTTP header injection and similar exploits. For example... We have

Is there a “no-reply” email header?

帅比萌擦擦* 提交于 2019-12-04 01:38:33
I often see automated emails postfixed with a message like Amazon: *Please note: this e-mail was sent from an address that cannot accept incoming e-mail. Please use the link above if you need to contact us again about this same issue. Twitter: Please do not reply to this message; it was sent from an unmonitored email address. This message is a service email related to your use of Twitter. Google Checkout: Need help? Visit the Google Checkout help center. Please do not reply to this message. Directly underneath this warning, Gmail shows me a reply input field. It seems to me that there should