/// <summary> /// Reads SMTP "Mailbox" from the specified MIME reader. /// </summary> /// <param name="reader">MIME reader.</param> /// <returns>Returns SMTP "Mailbox" or null if no SMTP mailbox available.</returns> /// <exception cref="ArgumentNullException">Is raised when <b>reader</b> is null reference.</exception> internal static string SMTP_Mailbox(MIME_Reader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } // TODO: /* RFC 5321. * Mailbox = Local-part "@" ( Domain / address-literal ) * Local-part = Dot-string / Quoted-string ; MAY be case-sensitive * Dot-string = Atom *("." Atom) */ StringBuilder retVal = new StringBuilder(); if (reader.Peek(true) == '\"') { retVal.Append("\"" + reader.QuotedString() + "\""); } else { retVal.Append(reader.DotAtom()); } if (reader.Peek(true) != '@') { return(null);; } else { // Eat "@". reader.Char(true); retVal.Append('@'); retVal.Append(reader.DotAtom()); } return(retVal.ToString()); }
/// <summary> /// Reads SMTP "Mailbox" from the specified MIME reader. /// </summary> /// <param name="reader">MIME reader.</param> /// <returns>Returns SMTP "Mailbox" or null if no SMTP mailbox available.</returns> /// <exception cref="ArgumentNullException">Is raised when <b>reader</b> is null reference.</exception> internal static string SMTP_Mailbox(MIME_Reader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } // TODO: /* RFC 5321. Mailbox = Local-part "@" ( Domain / address-literal ) Local-part = Dot-string / Quoted-string ; MAY be case-sensitive Dot-string = Atom *("." Atom) */ StringBuilder retVal = new StringBuilder(); if (reader.Peek(true) == '\"') { retVal.Append("\"" + reader.QuotedString() + "\""); } else { retVal.Append(reader.DotAtom()); } if (reader.Peek(true) != '@') { return null; ; } else { // Eat "@". reader.Char(true); retVal.Append('@'); retVal.Append(reader.DotAtom()); } return retVal.ToString(); }