示例#1
0
        public override async Task <ValidateSmtpSettingsReply> ValidateSmtpSettings(SmtpSettingsMessage request, ServerCallContext context)
        {
            SmtpCredentials credentials = new SmtpCredentials
            {
                Hostname      = request.Hostname,
                Password      = request.Password,
                Port          = request.Port,
                SenderAddress = request.SenderAddress,
                Username      = request.Username,
            };

            return(new ValidateSmtpSettingsReply
            {
                Success = await _smtpConnectivityChecker.CheckConnectivityAsnc(credentials),
            });
        }
示例#2
0
        public override async Task <ChangeSmtpSettingsReply> ChangeSmtpSettings(SmtpSettingsMessage request, ServerCallContext context)
        {
            SmtpCredentials credentials = new SmtpCredentials
            {
                Hostname      = request.Hostname,
                Password      = request.Password,
                Port          = request.Port,
                SenderAddress = request.SenderAddress,
                Username      = request.Username
            };
            await _smtpCredentialManager.StoreCredentialsAsync(credentials);

            return(new ChangeSmtpSettingsReply
            {
                Success = true,
            });
        }