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); }
public async Task SetSelectedProfileAsync(ConversionProfile profile) { IsUpdatingProfile = true; RaisePropertyChanged(nameof(IsUpdatingProfile)); Job.Profile = profile.Copy(); await UpdateProfileData(); IsUpdatingProfile = false; RaisePropertyChanged(nameof(IsUpdatingProfile)); }
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); }