rfc2822

Elegant way to serialize a MailMessage object in .NET

拥有回忆 提交于 2019-11-30 06:59:41
问题 I'm currently looking at serializing a MailMessage object in C# and although there are a couple of variations of an example on the net, they serialize to binary which kind of misses the point IMO. My approach is that I'd like to serialize a MailMessage to an RFC2822 eml string and the code below is what I've come up with. public string SerializeEmail(MailMessageArgs e) { string rfc822eml = ""; Guid g = Guid.NewGuid(); lock (g.ToString()) { System.IO.DirectoryInfo di = new System.IO

C# Email Regular Expression — Any out there that adhere to the RFC 2822 guidelines?

五迷三道 提交于 2019-11-29 15:09:31
问题 I realize that there are a ton of regex email validations, but I can't seem to find one that adheres to the RFC 2822 standard. The ones I find keep letting in junk like ..@abc.com get through. Forgive me if the one of the questions is already answered adhering to RFC 2822 (but not annotated that it is). 回答1: I did a post on this a short while ago. Yes, it is possible using .NET regex, since they have a non-regular feature called "balancing groups". The Perl RFC822 one that is often posted

Which date formats are IETF-compliant RFC 2822 timestamps?

大城市里の小女人 提交于 2019-11-29 06:03:08
I need to parse dates in JavaScript. The format is [2 digits day]/[2 digits month]/[4 digits year] [2 digits hour (24 mode)]:[2 digits minute] For example, 16/02/2013 21:00 But if I do new Date('16/02/2013 21:00').toString() , it gives 'Wed Apr 02 2014 21:00:00 GMT+0200 (Hora de verano romance)' . I guess that's because my dates don't follow IETF RFC 2822 Date and Time Specification. Then, I should convert my string, and I want to convert it to the most similar compliant format (because it should be easier to convert). But http://tools.ietf.org/html/rfc2822#page-14 is hard to understand, so I

Parsing RFC 2822 date in JAVA

喜欢而已 提交于 2019-11-28 08:25:26
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 time problems, problems I don't anticipate, etc... Thanks! Buhake Sindi This is quick code that does what you ask (using SimpleDateFormat ) String rfcDate = "Sat, 13 Mar 2010 11:29:05 -0800"; String pattern = "EEE, dd MMM yyyy HH:mm:ss Z"; SimpleDateFormat format = new

Parsing RFC 2822 date in JAVA

为君一笑 提交于 2019-11-27 05:46:56
问题 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 time problems, problems I don't anticipate, etc... Thanks! 回答1: This is quick code that does what you ask (using SimpleDateFormat ) String rfcDate = "Sat, 13 Mar 2010