Esempio n. 1
0
        public void SendTestMail(ConversionProfile profile, Accounts accounts)
        {
            var currentProfile = profile.Copy();

            currentProfile.AutoSave.Enabled = false;

            var job = CreateJob(currentProfile, accounts);

            _smtpMailAction.ApplyPreSpecifiedTokens(job);
            var result = _smtpMailAction.Check(job.Profile, job.Accounts, CheckLevel.Job);

            if (!result)
            {
                DisplayResult(result, job);
                return;
            }

            if (!TrySetJobPasswords(job, profile))
            {
                return;
            }

            var testFile = _path.Combine(_path.GetTempPath(), _translation.AttachmentFile + ".pdf");

            _file.WriteAllText(testFile, @"PDFCreator", Encoding.GetEncoding("Unicode"));
            job.OutputFiles.Add(testFile);

            result = _smtpMailAction.ProcessJob(job);
            DisplayResult(result, job);

            _file.Delete(testFile);
        }
Esempio n. 2
0
        public async Task SetSelectedProfileAsync(ConversionProfile profile)
        {
            IsUpdatingProfile = true;
            RaisePropertyChanged(nameof(IsUpdatingProfile));

            Job.Profile = profile.Copy();
            await UpdateProfileData();

            IsUpdatingProfile = false;
            RaisePropertyChanged(nameof(IsUpdatingProfile));
        }
Esempio n. 3
0
        public void SendTestMail(ConversionProfile profile, Accounts accounts)
        {
            var currentProfile = profile.Copy();

            currentProfile.AutoSave.Enabled = false;

            var signatureHelper = new MailSignatureHelper(_translator);

            var actionResult = _smtpMailAction.Check(currentProfile, accounts);

            if (!actionResult.IsSuccess)
            {
                DisplayErrorMessage(actionResult);
                return;
            }

            var jobTranslations = new JobTranslations();

            jobTranslations.EmailSignature = signatureHelper.ComposeMailSignature(currentProfile.EmailSmtpSettings);

            var job = CreateJob(jobTranslations, currentProfile, accounts);

            var success = TrySetJobPasswords(job, profile);

            if (!success)
            {
                return;
            }

            var testFile = _path.Combine(_path.GetTempPath(), "testfile.txt");

            _file.WriteAllText(testFile, @"PDFCreator", Encoding.GetEncoding("Unicode"));
            job.OutputFiles.Add(testFile);

            var recipients = currentProfile.EmailSmtpSettings.Recipients;

            actionResult = _smtpMailAction.ProcessJob(job);

            _file.Delete(testFile);
            DisplayResult(actionResult, recipients);
        }