private void ReadMultipartBody(MailReader reader, MailProperties properties) { string separator = GetSeparator(properties); string subtype = properties.GetMimeMediaSubtype(); reader.SetSeparator(null); string reply = reader.ReadLine(); ResetTimer(); if (reply != null) { while (reply != null && !reply.StartsWith(separator)) { reply = reader.ReadLine(); ResetTimer(); } } reader.SetSeparator(separator); while (true) { MailProperties props = ReadHeader(reader); if (props == null) { break; } ReadMessage(reader, props, separator); } }
private MailProperties ReadHeader(MailReader reader) { string temp; string reply = reader.ReadLine(); ResetTimer(); if ((reply == null) || reply.Equals(".")) { return(null); } MailProperties properties = null; while (!string.IsNullOrEmpty(reply)) { if (properties == null) { properties = new MailProperties(); } temp = reader.ReadLine(); ResetTimer(); if (temp == null) { return(properties); } if (temp.Equals(".")) { return(properties); } bool returnProps = false; // MultiLine headers have a space\tab at begining of each extra line while ((temp.StartsWith(" ")) || (temp.StartsWith("\t"))) { reply = reply + CRLF + temp; temp = reader.ReadLine(); ResetTimer(); if ((temp == null) || temp.Equals(".")) { returnProps = true; break; } } properties.PutKey(reply); reply = temp; if (returnProps) { return(properties); } } return(properties); }
public override void DecodeText(MailReader input, TextWriter output, GeneXus.Mail.Util.AsyncRunner runner) { string line; while (true) { line = input.ReadLine(); ResetTimer(runner); if ((line == null) || line.Equals(".")) { break; } output.WriteLine(line); } }
public override void DecodeFile(MailReader input, Stream output, GeneXus.Mail.Util.AsyncRunner runner) { string line; while (true) { line = input.ReadLine(); ResetTimer(runner); if ((line == null) || line.Equals(".")) { break; } byte[] bytes = input.GetEncoding().GetBytes(line + CRLF); output.Write(bytes, 0, bytes.Length); } }
private byte[] GetFromBase64String(MailReader input, GeneXus.Mail.Util.AsyncRunner runner) { StringBuilder strBuilder = new StringBuilder(); string str = null; while (true) { str = input.ReadLine(); ResetTimer(runner); if (string.IsNullOrEmpty(str) || str.Equals(".")) { break; } strBuilder.Append(str); } return(Convert.FromBase64String(strBuilder.ToString())); }