protected override void SendInternal(MailData data) { var message = composer.Compose(data); foreach (var address in message.To) { logger.Warn("No-send switch prevented sending message to {0}", address); } }
protected override void SendInternal(MailData data) { var message = composer.Compose(data); try { client.Send(message); } catch (Exception e) { var guid = dumper.Dump(message); logger.Error("Failed to send message to {1}. Created dump: {0}", guid, data.FullName()); logger.Error($"Message: {e.Message}"); } foreach (var address in message.To) { logger.Info("Send message to {0}", address); } }
private static void SimpleContextListener() { IContext context = CreateContext("TestContext"); IDispatcher dispatcher = context.Dispatcher; IMessageComposer composer = context.MessageComposer; ListenerA listener = new ListenerA(); dispatcher.RegisterListenerForAll(listener); PayloadA plA = new PayloadA(); PayloadB plB = new PayloadB(); var message = composer.Compose(plA, plB); dispatcher.Send(message); dispatcher.DispatchMessages(); }