public void IsOnlyToMeShouldBeFalseWhenOthersArePresent() { var service = new Mock <ExchangeService>(); var email = new EmailMessage(service.Object); email.ToRecipients.AddRange(emails); Assert.IsFalse(email.IsOnlyTo("*****@*****.**")); }
private void ProcessMessage(EmailMessage message) { var user = Robot.GetUser( message.From.Address, message.From.Name, message.Id.UniqueId, Id); var messageBody = message.UniqueBody.Text.Trim(); if (config.TrimSignature) { messageBody = TrimSignatureFromBody(messageBody); } if (config.AllowImplicitCommand && message.IsOnlyTo(config.Email)) { if (!messageBody.StartsWith(Robot.Name, StringComparison.InvariantCultureIgnoreCase)) { messageBody = Robot.Name + ", " + messageBody; } } //TODO: Try and add spoofed address detection Logger.Info(string.Format("Received message from {0}: {1}", user.Id, messageBody)); if (string.IsNullOrEmpty(messageBody)) { Logger.Info("Skipping empty message: " + message.Subject); return; } var robotMessage = new TextMessage(user, messageBody); SystemTask.Task.Run(() => Robot.Receive(robotMessage)); }