public EmailClientAggregate(IEmailMessageRepository emailRepository, IAtachmentRepository atachmentRepository,
                             IEmailClientFactory emailFactory)
 {
     _emailRepository     = emailRepository;
     _atachmentRepository = atachmentRepository;
     _emailFactory        = emailFactory;
 }
Exemplo n.º 2
0
        private static HtmlEmailMessageSender GetEmailSender(UserConnection userConnection)
        {
            ConstructorArgument    userConnectionArg  = new ConstructorArgument("userConnection", userConnection);
            IEmailClientFactory    emailClientFactory = ClassFactory.Get <EmailClientFactory>(userConnectionArg);
            HtmlEmailMessageSender sender             = new HtmlEmailMessageSender(emailClientFactory, userConnection);

            return(sender);
        }
Exemplo n.º 3
0
 public ClientTestEmail(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper, IPath path, IDirectory directory, IFile file)
 {
     _emailClientFactory  = emailClientFactory;
     _mailSignatureHelper = mailSignatureHelper;
     _path      = path;
     _directory = directory;
     _file      = file;
 }
Exemplo n.º 4
0
 public EmailClientAggregate(IEmailMessageRepository emailMessageRepository,
                             ISendedEmailMessageRepository sendedEmailMessageRepository,
                             IEmailClientFactory emailClientFactory,
                             IEmailAccountRepository emailAccountRepository)
 {
     _emailMessageRepository       = emailMessageRepository;
     _sendedEmailMessageRepository = sendedEmailMessageRepository;
     _emailAccountRepository       = emailAccountRepository;
     _emailClientFactory           = emailClientFactory;
 }
Exemplo n.º 5
0
        public void EmailClientAction_NoClientInstalled_ReturnsActionresultWithId101()
        {
            _emailClientFactory = MockRepository.GenerateStub <IEmailClientFactory>();
            _emailClientFactory.Stub(x => x.CreateEmailClient()).Return(null);
            var action = new EMailClientAction(_emailClientFactory, SignatureText);

            var result = action.ProcessJob(_job);

            Assert.AreEqual(11101, result[0]);
        }
        public void EmailClientAction_NoClientInstalled_ReturnsActionresultWithId101()
        {
            _emailClientFactory = Substitute.For <IEmailClientFactory>();
            _emailClientFactory.CreateEmailClient().Returns(x => null);
            var action = BuildAction();

            var result = action.ProcessJob(_job);

            Assert.AreEqual(ErrorCode.MailClient_NoCompatibleEmailClientInstalled, result[0]);
        }
 public SendedEmailMessageService(
     ISendedEmailMessageRepository sendedEmailMessageRepository,
     IEmailAccountRepository emailAccountRepository,
     IEmailClientFactory emailClientFactory,
     IEmailClientAggregate emailClientAggregate,
     IMapper mapper)
 {
     _sendedEmailMessageRepository = sendedEmailMessageRepository;
     _emailAccountRepository       = emailAccountRepository;
     _emailClientFactory           = emailClientFactory;
     _emailClientAggregate         = emailClientAggregate;
     _mapper = mapper;
 }
Exemplo n.º 8
0
        public void Setup()
        {
            _pathWrap           = Substitute.For <IPath>();
            _directoryWrap      = Substitute.For <IDirectory>();
            _fileWrap           = Substitute.For <IFile>();
            _emailClient        = Substitute.For <IEmailClient>();
            _emailClientFactory = Substitute.For <IEmailClientFactory>();
            _emailClientFactory.CreateEmailClient().Returns(_emailClient);
            _mailSignatureHelper = Substitute.For <IMailSignatureHelper>();
            _clientTestEmail     = new ClientTestEmail(_emailClientFactory, _mailSignatureHelper, _pathWrap,
                                                       _directoryWrap, _fileWrap);

            _emailClientSettings = new EmailClientSettings();
        }
Exemplo n.º 9
0
        public void SetUp()
        {
            _tokenReplacer = new TokenReplacer();

            _profile = new ConversionProfile();
            _profile.EmailClient.Enabled      = true;
            _profile.EmailClient.Subject      = "testsubject";
            _profile.EmailClient.Content      = "This is content\r\nwith line breaks";
            _profile.EmailClient.AddSignature = false;
            _profile.EmailClient.Recipients   = "test@local";

            _job = MockRepository.GenerateStub <IJob>();
            _job.TokenReplacer = _tokenReplacer;
            _job.OutputFiles   = new[] { @"C:\Temp\file1.pdf" }.ToList();
            _job.Profile       = _profile;

            _mockMailClient = new MockMailClient();

            _emailClientFactory = MockRepository.GenerateStub <IEmailClientFactory>();
            _emailClientFactory.Stub(x => x.CreateEmailClient()).Return(_mockMailClient);
        }
        public virtual void SendEmailWithDefaultSender(EmailMessage emailMessage)
        {
            ConstructorArgument userConnectionArg  = new ConstructorArgument("userConnection", UserConnection);
            IEmailClientFactory emailClientFactory = ClassFactory.Get <EmailClientFactory>(userConnectionArg);

            if (UserConnection.GetIsFeatureEnabled("EmailIntegrationV2"))
            {
                try {
                    var sender = new ActivityEmailSender(emailClientFactory, UserConnection);
                    sender.Send(emailMessage, true);
                } catch {
                    if (!IsIgnoreErrors)
                    {
                        throw;
                    }
                }
            }
            else
            {
                var credentials = new Terrasoft.Mail.MailCredentials {
                    Host         = (string)Core.Configuration.SysSettings.GetValue(UserConnection, "SmtpHost"),
                    Port         = int.Parse(Core.Configuration.SysSettings.GetValue(UserConnection, "SmtpPort").ToString()),
                    UseSsl       = (bool)Core.Configuration.SysSettings.GetValue(UserConnection, "SmtpEnableSsl"),
                    UserName     = (string)Core.Configuration.SysSettings.GetValue(UserConnection, "SmtpUserName"),
                    UserPassword = (string)Core.Configuration.SysSettings.GetValue(UserConnection, "SmtpUserPassword")
                };
                try {
                    var emailClientFactoryArg = new ConstructorArgument("emailClientFactory", emailClientFactory);
                    var emailSener            = ClassFactory.Get <IEmailSender>(emailClientFactoryArg, userConnectionArg);
                    emailSener.Send(emailMessage, credentials);
                } catch {
                    if (!IsIgnoreErrors)
                    {
                        throw;
                    }
                }
            }
        }
Exemplo n.º 11
0
 public EmailManager(IEmailClientFactory emailFactory)
 {
     _emailFactory = emailFactory;
     _allEmails    = new List <EmailModel>();
     _unseenEmails = new List <EmailModel>();
 }
Exemplo n.º 12
0
 public EMailClientAction(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper, IFile file, IMailHelper mailHelper)
 {
     _emailClientFactory = emailClientFactory;
     _file       = file;
     _mailHelper = mailHelper;
 }
Exemplo n.º 13
0
 public EMailClientAction(IEmailClientFactory emailClientFactory, string signatureText)
 {
     _emailClientFactory = emailClientFactory;
     _signatureText      = signatureText;
 }
Exemplo n.º 14
0
 public EMailClientAction(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper)
 {
     _emailClientFactory  = emailClientFactory;
     _mailSignatureHelper = mailSignatureHelper;
 }
Exemplo n.º 15
0
 public EMailClientAction(IEmailClientFactory emailClientFactory)
 {
     _emailClientFactory = emailClientFactory;
 }
Exemplo n.º 16
0
 public IncomingEmailService(IEmailClientFactory clientFactory)
 {
     _clientFactory = clientFactory;
 }
Exemplo n.º 17
0
 /// <summary><see cref="EmailSender"/> ctor.</summary>
 /// <param name="emailClientFactory">An instance of the mail client factory.</param>
 /// <param name="userConnection">An instance of the user connection.</param>
 public EmailSender(IEmailClientFactory emailClientFactory, UserConnection userConnection)
 {
     _emailClientFactory = emailClientFactory;
     _userConnection     = userConnection;
 }
Exemplo n.º 18
0
 /// <summary><see cref="ActivityEmailSender"/> ctor.</summary>
 /// <param name="emailClientFactory">An instance of the mail client factory.</param>
 /// <param name="userConnection">An instance of the user connection.</param>
 public ActivityEmailSender(IEmailClientFactory emailClientFactory, UserConnection userConnection)
     : base(emailClientFactory, userConnection)
 {
 }
Exemplo n.º 19
0
 /// <summary>Initialize new instance of the <see cref="HtmlEmailMessageSender"/> class.</summary>
 /// <param name="emailClientFactory">EmailClient factory instance.</param>
 /// <param name="userConnection">User connection instance.</param>
 public HtmlEmailMessageSender(IEmailClientFactory emailClientFactory, UserConnection userConnection)
     : base(emailClientFactory, userConnection)
 {
 }
Exemplo n.º 20
0
 /// <summary>Initialize new instance of the <see cref="SecureActivityEmailSender"/> class.</summary>
 /// <param name="emailClientFactory">EmailClient factory instance.</param>
 /// <param name="userConnection">User connection instance.</param>
 public SecureActivityEmailSender(IEmailClientFactory emailClientFactory, UserConnection userConnection)
     : base(emailClientFactory, userConnection)
 {
     SecurityTokenUtilities = new SecurityTokenUtilities(userConnection);
 }