private bool HandleMailFrom(MailMessage message, string nextLine) { MailAddress sender; try { sender = EmailParser.ParseEmailFromString(nextLine); } catch { _clientController.Write(ServerStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.MbNameNotAllowed)); return(true); } message.From = sender; _clientController.Write(ServerStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.RqstActOkCompleted)); return(false); }
private bool HandleMailTo(MailMessage message, string nextLine) { MailAddress recipient; try { recipient = EmailParser.ParseEmailFromString(nextLine); } catch { _clientController.Write(ServerStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.MbNameNotAllowed)); return(true); } if (message.To.All(a => a.Address != recipient.Address)) { message.To.Add(recipient); } _clientController.Write(ServerStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.RqstActOkCompleted)); return(false); }