public void Handle(NotEnoughCreditDto notEnoughCreditDto) { _notEnoughCreditDto = notEnoughCreditDto; var emailClient = new SendEmailClient(_mailInfo.Hostname, _mailInfo.Hostport, _mailInfo.Username, _mailInfo.Password, _mailInfo.Security); var noteVeicoloSender = new NoteVeicoloSender(emailClient.ComposeMessage(_mailInfo.From), this); noteVeicoloSender.Send(_receiverString); }
public void Send(long idNota, string receiverMail, string connection) { var emailClient = new SendEmailClient(_mailInfo.Hostname, _mailInfo.Hostport, _mailInfo.Username, _mailInfo.Password, _mailInfo.Security); var messageProvider = new NoteVeicoloMessageProvider((int)idNota, Connections.Strings[connection]); var noteVeicoloSender = new NoteVeicoloSender(emailClient.ComposeMessage(_mailInfo.From, receiverMail), messageProvider); noteVeicoloSender.Send(receiverMail); }
private void SendSms(string receiverPhoneNumber, ISenderService senderService, IMessageProvider messageProvider) { try { var noteVeicoloSender = new NoteVeicoloSender(senderService, messageProvider); noteVeicoloSender.Send(receiverPhoneNumber); _log.Info($"Sms inviato a {receiverPhoneNumber}"); } catch (SmsCreditException e) { _log.Info($"Rilevato credito insufficiente inviando sms a {receiverPhoneNumber}"); OnNotEnoughCredit(new NotEnoughCreditDto(e.Credit)); throw; } }