예제 #1
0
 /// <summary>Returns certain <see cref="IEmailClient"/> class instance.</summary>
 /// <param name="credentials">An instance of <see cref="DTO.Credentials"/> user credentials.</param>
 /// <returns>Certain <see cref="IEmailClient"/> class instance.</returns>
 protected IEmailClient GetCertainEmailClient(DTO.Credentials credentials)
 {
     if (UserConnection.GetIsFeatureEnabled("EmailIntegrationV2"))
     {
         return(ClassFactory.Get <IEmailClient>(
                    new ConstructorArgument("userConnection", UserConnection),
                    new ConstructorArgument("emailCredentials", credentials)
                    ));
     }
     return(null);
 }
예제 #2
0
 /// <summary>
 /// Convert <see cref="DTO.Credentials"/> to <see cref="MailCredentials"/> instance.
 /// </summary>
 /// <param name="credentials"><see cref="DTO.Credentials"/> instance.</param>
 /// <returns><see cref="MailCredentials"/> credentials.</returns>
 private MailCredentials ConvertToMailCredentials(DTO.Credentials credentials)
 {
     return(new MailCredentials {
         Host = credentials.ServiceUrl,
         Port = credentials.Port,
         UserName = credentials.UserName,
         UserPassword = credentials.Password,
         UseSsl = credentials.UseSsl,
         UseOAuth = credentials.UseOAuth,
         SenderEmailAddress = credentials.SenderEmailAddress
     });
 }
예제 #3
0
 /// <summary>
 /// <see cref="EmailClient"/> ctor.
 /// </summary>
 /// <param name="userConnection">An instance of the user connection.</param>
 /// <param name="credentials">Short email connection credentials.</param>
 public EmailClient(UserConnection userConnection, Mail.Credentials credentials)
     : this(userConnection) {
     var mailServer = GetMailServer(credentials.ServerId);
     _credentials = new Credentials {
         UserName     = credentials.UserName,
         Password     = credentials.UserPassword,
         UseOAuth     = credentials.UseOAuth,
         ServiceUrl   = mailServer.ServerAddress,
         ServerTypeId = mailServer.TypeId,
         Port         = mailServer.Port,
         UseSsl       = mailServer.UseSsl
     };
 }
예제 #4
0
 /// <summary>
 /// Returns an email client object that implements interface <see cref="IEmailClient"/>
 /// according to specified connection parameters.</summary>
 /// <param name="credentials">Connection credentials.</param>
 /// <returns>Instance of <see cref="IEmailClient"/>.</returns>
 public virtual IEmailClient CreateEmailClient(DTO.Credentials credentials)
 {
     return(GetCertainEmailClient(credentials) ?? GetSmtpClient(credentials));
 }
예제 #5
0
 /// <summary>
 /// <see cref="EmailClient"/> ctor.
 /// </summary>
 /// <param name="userConnection">An instance of the user connection.</param>
 /// <param name="emailCredentials">Full email connection credentials.</param>
 public EmailClient(UserConnection userConnection, Credentials emailCredentials)
     : this(userConnection) {
     _credentials = emailCredentials;
 }