├── CNAME ├── _config.yml ├── installation ├── service │ ├── chocolatey │ │ └── tools │ │ │ ├── Papercut.exe.gui │ │ │ ├── Verification.txt │ │ │ ├── LICENSE.txt │ │ │ └── chocolateyInstall.ps1 │ ├── install-papercut-service.bat │ └── uninstall-papercut-service.bat └── winget │ ├── ChangemakerStudios.PapercutSMTP.yaml │ ├── ChangemakerStudios.PapercutSMTP.installer.yaml │ └── ChangemakerStudios.PapercutSMTP.locale.en-US.yaml ├── src ├── Papercut.Service │ ├── appsettings.Production.json │ ├── launch.sh │ ├── electron.manifest.json │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── launchSettings.json │ ├── GlobalUsings.cs │ ├── app.config │ ├── icons │ │ ├── Papercut-icon.icns │ │ ├── Papercut-icon.ico │ │ └── Papercut-icon.png │ ├── Papercut-Service-icon.ico │ ├── Web │ │ ├── Assets │ │ │ ├── images │ │ │ │ ├── github.png │ │ │ │ ├── papercut.ico │ │ │ │ ├── Papercut-icon.png │ │ │ │ ├── papercut-logo.png │ │ │ │ └── loading-spinner.gif │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ │ └── message-repository.js │ │ ├── Notification │ │ │ └── NewMessagesHub.cs │ │ ├── Hosting │ │ │ ├── PapercutWebServerReadyEvent.cs │ │ │ └── InProcess │ │ │ │ └── RequestFeature.cs │ │ ├── Models │ │ │ └── MessageDetail.cs │ │ └── FileHelper.cs │ ├── appsettings.json │ ├── package.json │ ├── appsettings.Development.json │ ├── Domain │ │ ├── ISmtpServerOptionsProvider.cs │ │ └── SmtpServer │ │ │ └── SmtpServerSettings.cs │ ├── start-electron-app.sh │ ├── start-electron-app.bat │ ├── Application │ │ └── Controllers │ │ │ ├── GetMessagesResponse.cs │ │ │ └── HealthController.cs │ └── Infrastructure │ │ └── Logging │ │ └── AddReadFromConfiguration.cs ├── Papercut.UI │ ├── App.ico │ ├── GlobalUsings.cs │ ├── Domain │ │ ├── Themes │ │ │ ├── ThemeColor.cs │ │ │ └── BaseTheme.cs │ │ ├── LifecycleHooks │ │ │ ├── IAppLifecycleHook.cs │ │ │ ├── AppLifecycleActionResultType.cs │ │ │ ├── IAppLifecycleStarted.cs │ │ │ ├── IAppLifecyclePreExit.cs │ │ │ └── IAppLifecyclePreStart.cs │ │ ├── UiCommands │ │ │ ├── Commands │ │ │ │ ├── ShowOptionWindowCommand.cs │ │ │ │ ├── ShowMainWindowCommand.cs │ │ │ │ ├── ShowMessageCommand.cs │ │ │ │ └── ShowBalloonTipCommand.cs │ │ │ └── IUiCommandHub.cs │ │ ├── BackendService │ │ │ └── BackendServiceStatus.cs │ │ ├── AppCommands │ │ │ ├── IAppCommandHub.cs │ │ │ └── ShutdownCommand.cs │ │ ├── Events │ │ │ ├── ThemeChangedEvent.cs │ │ │ ├── SettingsUpdatedEvent.cs │ │ │ └── PapercutServiceStatusEvent.cs │ │ ├── HtmlPreviews │ │ │ └── IHtmlPreviewGenerator.cs │ │ └── Application │ │ │ └── PapercutAppConstants.cs │ ├── Resources │ │ ├── attachment-icon.png │ │ ├── PapercutSMTP-Installation-Splash.png │ │ └── LogClientSink.html │ ├── Infrastructure │ │ ├── Themes │ │ │ └── ThemeColorRepository.cs │ │ ├── Container │ │ │ └── AutofacServiceProvider.cs │ │ └── VelopackBridgeLogger.cs │ ├── AppLayer │ │ ├── Behaviors │ │ │ ├── InteractivityBlurWindowOnDeactivate.cs │ │ │ ├── InteractivityBlurOnDisabled.cs │ │ │ └── InteractivityBlurBase.cs │ │ ├── NewVersionCheck │ │ │ └── INewVersionProvider.cs │ │ ├── Logging │ │ │ └── SeqLogging.cs │ │ ├── Diagnostics │ │ │ └── ReportVersionService.cs │ │ └── Themes │ │ │ └── SystemThemeRegistryHelper.cs │ ├── build-vpk.bat │ ├── ViewModels │ │ ├── IMessageDetailItem.cs │ │ ├── MimePartViewModel.cs │ │ └── RuleTypeSelectionViewModel.cs │ ├── Views │ │ ├── MainView.xaml.cs │ │ ├── ForwardView.xaml.cs │ │ ├── OptionsView.xaml.cs │ │ ├── MessageListView.xaml.cs │ │ ├── MessageDetailView.xaml.cs │ │ ├── MessageDetailRawView.xaml.cs │ │ ├── MessageDetailBodyView.xaml.cs │ │ ├── MessageDetailHtmlView.xaml.cs │ │ ├── MimePartView.xaml.cs │ │ ├── MessageDetailHeaderView.xaml.cs │ │ ├── MessageDetailPartsListView.xaml.cs │ │ ├── RulesConfigurationView.xaml.cs │ │ ├── MessageDetailHeaderView.xaml │ │ └── MessageDetailBodyView.xaml │ ├── Helpers │ │ ├── WireupLogBridge.cs │ │ ├── HandlebarHelpers.cs │ │ ├── Themes.cs │ │ ├── MailMessageHelper.cs │ │ ├── ZoomIndicator.xaml │ │ ├── IViewModelWindowManager.cs │ │ ├── CalburnSerilogBridge.cs │ │ ├── EventHandlerHelpers.cs │ │ └── DisableEdgeFeaturesHelper.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ └── app.manifest ├── Papercut.Common │ ├── Domain │ │ ├── IEvent.cs │ │ ├── ICommand.cs │ │ ├── IMessage.cs │ │ ├── IMessageBus.cs │ │ ├── IOrderable.cs │ │ ├── IEventHandler.cs │ │ └── ICommandHandler.cs │ ├── Helper │ │ ├── EnumHelpers.cs │ │ ├── AssemblyHelper.cs │ │ ├── PathHelpers.cs │ │ └── RegexHelpers.cs │ ├── Extensions │ │ ├── ObjectExtensions.cs │ │ ├── CollectionExtensions.cs │ │ ├── OrderableExtensions.cs │ │ └── EnumerableExtensions.cs │ ├── Papercut.Common.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Papercut.Core │ ├── Domain │ │ ├── Settings │ │ │ ├── IReadValue.cs │ │ │ ├── IWriteValue.cs │ │ │ ├── JsonSettingStore.cs │ │ │ ├── ISettingsTyped.cs │ │ │ ├── ISettingStore.cs │ │ │ └── SettingsTypedExtensions.cs │ │ ├── Paths │ │ │ ├── IPathConfigurator.cs │ │ │ ├── LoggingPathConfigurator.cs │ │ │ ├── MessagePathConfigurator.cs │ │ │ ├── NoValidSavePathFoundException.cs │ │ │ └── IPathTemplatesProvider.cs │ │ ├── Message │ │ │ ├── IReceivedDataHandler.cs │ │ │ ├── IFile.cs │ │ │ ├── NewMessageEvent.cs │ │ │ ├── NewMessageEventArgs.cs │ │ │ └── MessageEntryDto.cs │ │ ├── Network │ │ │ ├── Smtp │ │ │ │ ├── SmtpServerBindFailedEvent.cs │ │ │ │ ├── SmtpServerForceRebindEvent.cs │ │ │ │ └── SmtpServerBindEvent.cs │ │ │ └── IServer.cs │ │ ├── Application │ │ │ ├── IAppMeta.cs │ │ │ └── ApplicationMeta.cs │ │ ├── Rules │ │ │ ├── RulesUpdatedEvent.cs │ │ │ ├── IRuleDispatcher.cs │ │ │ ├── IRulesRunner.cs │ │ │ └── IRule.cs │ │ └── BackgroundTasks │ │ │ └── IBackgroundTaskRunner.cs │ ├── Infrastructure │ │ ├── MessageBus │ │ │ ├── AutofacMessageBus.cs │ │ │ ├── MessageBusExtensions.cs │ │ │ └── PublishEventExtensions.cs │ │ ├── Lifecycle │ │ │ ├── PapercutClientExitEvent.cs │ │ │ ├── PapercutServiceExitEvent.cs │ │ │ ├── PapercutServiceReadyEvent.cs │ │ │ ├── PapercutClientReadyEvent.cs │ │ │ └── PapercutServicePreStartEvent.cs │ │ ├── Network │ │ │ ├── ServiceWebUISettingsExchangeEvent.cs │ │ │ ├── AppProcessExchangeEvent.cs │ │ │ └── BaseBindEvent.cs │ │ ├── Container │ │ │ ├── ContainerScope.cs │ │ │ ├── SimpleContainer.cs │ │ │ └── AutofacRegistrationExtensions.cs │ │ ├── Logging │ │ │ └── LoggerExtensions.cs │ │ └── Consoles │ │ │ └── ConsoleHelpers.cs │ ├── AppConstants.cs │ ├── Papercut.Core.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Papercut.Rules │ ├── App │ │ ├── Relaying │ │ │ └── RelayRuleDispatch.cs │ │ ├── Forwarding │ │ │ └── ForwardRuleDispatch.cs │ │ └── Conditional │ │ │ ├── ConditionalRuleExtensions.cs │ │ │ ├── Relaying │ │ │ └── ConditionalRelayRuleDispatch.cs │ │ │ └── Forwarding │ │ │ └── ConditionalForwardRuleDispatch.cs │ ├── Domain │ │ ├── Conditional │ │ │ └── IConditionalRule.cs │ │ └── Rules │ │ │ └── IRuleRepository.cs │ ├── Papercut.Rules.csproj │ ├── PapercutRuleModule.cs │ ├── Infrastructure │ │ └── ObservableExtensions.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Papercut.Infrastructure.IPComm │ ├── Protocols │ │ ├── IProtocol.cs │ │ └── StringCommandProtocol.cs │ ├── Network │ │ ├── PapercutIPCommCommandType.cs │ │ ├── PapercutIPCommRequest.cs │ │ └── PapercutIPCommConstants.cs │ ├── Papercut.Infrastructure.IPComm.csproj │ ├── PapercutIPCommModule.cs │ └── Papercut - Backup.Infrastructure.IPComm.csproj ├── Papercut.Message │ ├── Helpers │ │ └── MimeMessageLoaderExtensions.cs │ ├── IMimeMessageLoader.cs │ ├── Papercut.Message.csproj │ ├── IMessageRepository.cs │ └── PapercutMessageModule.cs ├── Papercut.Service.TrayNotification │ ├── icons │ │ └── Papercut-icon.ico │ ├── GlobalUsings.cs │ ├── Papercut.Service.TrayNotification.csproj │ ├── Infrastructure │ │ └── PapercutServiceTrayModule.cs │ ├── AppLayer │ │ └── TrayLoggingPathConfigurator.cs │ └── app.manifest └── Papercut.Infrastructure.Smtp │ ├── Papercut.Infrastructure.Smtp.csproj │ ├── SimpleAuthentication.cs │ ├── SmtpMessageStore.cs │ └── SessionContextExtensions.cs ├── examples ├── SendEmailTest │ └── SendEmailTest.csproj ├── SendEmailWithTls │ └── SendEmailWithTls.csproj ├── SendWordWrapTest │ └── SendWordWrapTest.csproj ├── SendRichEmailTest │ └── SendRichEmailTest.csproj ├── SendEmailWithFileLinks │ └── SendEmailWithFileLinks.csproj ├── SendEmailWithPdfAttachment │ └── SendEmailWithPdfAttachment.csproj ├── SmtpClientHelper.cs ├── resources │ └── sample.pdf ├── appsettings.json ├── SendEmailTestWithBadSSL │ └── SendEmailTestWithBadSSL.csproj ├── SmtpSendOptions.cs └── Directory.Build.props ├── graphics ├── icon.ai ├── PapercutLogo.png ├── Papercut-icon.png ├── gear │ ├── icon_6881.png │ └── license.txt ├── PapercutV7-Main-1.png ├── papercut-choice.png ├── Papercut-2013.3-SS1.png ├── Papercut-2013.3-SS2.png ├── Papercut-2014.3-SS1.png ├── Papercut-Service-icon.ico ├── Papercut-Service-icon.png ├── PapercutV7-Notification-1.png ├── PapercutLogo.psd └── PapercutLogoV2.psd ├── GitVersion.yml ├── .dockerignore ├── .gitignore ├── .github ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── stale.yml ├── test ├── Papercut.Rules.Tests │ └── Papercut.Rules.Tests.csproj ├── Papercut.Infrastructure.Smtp.Tests │ └── Papercut.Infrastructure.Smtp.Tests.csproj ├── Papercut.Message.Tests │ └── Papercut.Message.Tests.csproj └── Papercut.Core.Tests │ └── Papercut.Core.Tests.csproj └── Directory.Build.props /CNAME: -------------------------------------------------------------------------------- 1 | www.papercut-smtp.com -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /installation/service/chocolatey/tools/Papercut.exe.gui: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Papercut.Service/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /src/Papercut.Service/launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cmd="$1 >> $2 2>&1 &" 4 | eval $cmd 5 | wait -------------------------------------------------------------------------------- /examples/SendEmailTest/SendEmailTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/SendEmailWithTls/SendEmailWithTls.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /graphics/icon.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/icon.ai -------------------------------------------------------------------------------- /examples/SendWordWrapTest/SendWordWrapTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/SendRichEmailTest/SendRichEmailTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /graphics/PapercutLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/PapercutLogo.png -------------------------------------------------------------------------------- /src/Papercut.UI/App.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/App.ico -------------------------------------------------------------------------------- /examples/SendEmailWithFileLinks/SendEmailWithFileLinks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /graphics/Papercut-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-icon.png -------------------------------------------------------------------------------- /graphics/gear/icon_6881.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/gear/icon_6881.png -------------------------------------------------------------------------------- /src/Papercut.Service/electron.manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "executable": "Papercut.Service", 3 | "name": "Papercut SMTP" 4 | } -------------------------------------------------------------------------------- /examples/SendEmailWithPdfAttachment/SendEmailWithPdfAttachment.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/SmtpClientHelper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/examples/SmtpClientHelper.cs -------------------------------------------------------------------------------- /examples/resources/sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/examples/resources/sample.pdf -------------------------------------------------------------------------------- /graphics/PapercutV7-Main-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/PapercutV7-Main-1.png -------------------------------------------------------------------------------- /graphics/papercut-choice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/papercut-choice.png -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDelivery 2 | branches: 3 | feature: 4 | increment: Patch 5 | develop: 6 | increment: Patch -------------------------------------------------------------------------------- /graphics/Papercut-2013.3-SS1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-2013.3-SS1.png -------------------------------------------------------------------------------- /graphics/Papercut-2013.3-SS2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-2013.3-SS2.png -------------------------------------------------------------------------------- /graphics/Papercut-2014.3-SS1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-2014.3-SS1.png -------------------------------------------------------------------------------- /src/Papercut.Service/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Papercut.WebUI.Tests")] -------------------------------------------------------------------------------- /src/Papercut.UI/GlobalUsings.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/GlobalUsings.cs -------------------------------------------------------------------------------- /graphics/Papercut-Service-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-Service-icon.ico -------------------------------------------------------------------------------- /graphics/Papercut-Service-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/Papercut-Service-icon.png -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/IEvent.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Domain/IEvent.cs -------------------------------------------------------------------------------- /src/Papercut.Service/GlobalUsings.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/GlobalUsings.cs -------------------------------------------------------------------------------- /graphics/PapercutV7-Notification-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/graphics/PapercutV7-Notification-1.png -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/ICommand.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Domain/ICommand.cs -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/IMessage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Domain/IMessage.cs -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/IMessageBus.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Domain/IMessageBus.cs -------------------------------------------------------------------------------- /src/Papercut.Common/Helper/EnumHelpers.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Helper/EnumHelpers.cs -------------------------------------------------------------------------------- /src/Papercut.Service/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Papercut.Service/icons/Papercut-icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/icons/Papercut-icon.icns -------------------------------------------------------------------------------- /src/Papercut.Service/icons/Papercut-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/icons/Papercut-icon.ico -------------------------------------------------------------------------------- /src/Papercut.Service/icons/Papercut-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/icons/Papercut-icon.png -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Themes/ThemeColor.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/Domain/Themes/ThemeColor.cs -------------------------------------------------------------------------------- /src/Papercut.UI/Resources/attachment-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/Resources/attachment-icon.png -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/IReadValue.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Settings/IReadValue.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Papercut-Service-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Papercut-Service-icon.ico -------------------------------------------------------------------------------- /graphics/PapercutLogo.psd: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:8f304aaee17d4dd7e7bd8aa7d5c2d7d223cad77b0c4931bafe229be710466aa4 3 | size 711965 4 | -------------------------------------------------------------------------------- /src/Papercut.Common/Extensions/ObjectExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Extensions/ObjectExtensions.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/IWriteValue.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Settings/IWriteValue.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/images/github.png -------------------------------------------------------------------------------- /graphics/PapercutLogoV2.psd: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:147d0df2b5d8987f872afa4897e5c7176f79d7d2797c3e355497bdcb20e5cc78 3 | size 578547 4 | -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Paths/IPathConfigurator.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Paths/IPathConfigurator.cs -------------------------------------------------------------------------------- /src/Papercut.Rules/App/Relaying/RelayRuleDispatch.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Rules/App/Relaying/RelayRuleDispatch.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/images/papercut.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/images/papercut.ico -------------------------------------------------------------------------------- /src/Papercut.Common/Extensions/CollectionExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Common/Extensions/CollectionExtensions.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/JsonSettingStore.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Settings/JsonSettingStore.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Message/IReceivedDataHandler.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Message/IReceivedDataHandler.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Paths/LoggingPathConfigurator.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Paths/LoggingPathConfigurator.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Paths/MessagePathConfigurator.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Paths/MessagePathConfigurator.cs -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Protocols/IProtocol.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Infrastructure.IPComm/Protocols/IProtocol.cs -------------------------------------------------------------------------------- /src/Papercut.Rules/App/Forwarding/ForwardRuleDispatch.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Rules/App/Forwarding/ForwardRuleDispatch.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/images/Papercut-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/images/Papercut-icon.png -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/images/papercut-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/images/papercut-logo.png -------------------------------------------------------------------------------- /src/Papercut.Message/Helpers/MimeMessageLoaderExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Message/Helpers/MimeMessageLoaderExtensions.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/images/loading-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/images/loading-spinner.gif -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/icons/Papercut-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service.TrayNotification/icons/Papercut-icon.ico -------------------------------------------------------------------------------- /src/Papercut.UI/Infrastructure/Themes/ThemeColorRepository.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/Infrastructure/Themes/ThemeColorRepository.cs -------------------------------------------------------------------------------- /src/Papercut.UI/Resources/PapercutSMTP-Installation-Splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/Resources/PapercutSMTP-Installation-Splash.png -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Paths/NoValidSavePathFoundException.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Paths/NoValidSavePathFoundException.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/MessageBus/AutofacMessageBus.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Infrastructure/MessageBus/AutofacMessageBus.cs -------------------------------------------------------------------------------- /src/Papercut.Rules/App/Conditional/ConditionalRuleExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Rules/App/Conditional/ConditionalRuleExtensions.cs -------------------------------------------------------------------------------- /examples/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "SmtpSend": { 3 | "Host": "127.0.0.1", 4 | "Port": 25, 5 | "Security": "None", 6 | "Username": null, 7 | "Password": null 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Network/Smtp/SmtpServerBindFailedEvent.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Domain/Network/Smtp/SmtpServerBindFailedEvent.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/MessageBus/MessageBusExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Infrastructure/MessageBus/MessageBusExtensions.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Lifecycle/PapercutClientExitEvent.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Infrastructure/Lifecycle/PapercutClientExitEvent.cs -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Lifecycle/PapercutServiceExitEvent.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Infrastructure/Lifecycle/PapercutServiceExitEvent.cs -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Protocols/StringCommandProtocol.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Infrastructure.IPComm/Protocols/StringCommandProtocol.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Lifecycle/PapercutServiceReadyEvent.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Core/Infrastructure/Lifecycle/PapercutServiceReadyEvent.cs -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Network/PapercutIPCommCommandType.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Infrastructure.IPComm/Network/PapercutIPCommCommandType.cs -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Service/Web/Assets/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/Papercut.Rules/App/Conditional/Relaying/ConditionalRelayRuleDispatch.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Rules/App/Conditional/Relaying/ConditionalRelayRuleDispatch.cs -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Behaviors/InteractivityBlurWindowOnDeactivate.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.UI/AppLayer/Behaviors/InteractivityBlurWindowOnDeactivate.cs -------------------------------------------------------------------------------- /installation/winget/ChangemakerStudios.PapercutSMTP.yaml: -------------------------------------------------------------------------------- 1 | PackageIdentifier: "ChangemakerStudios.PapercutSMTP" 2 | PackageVersion: "7.6.2" 3 | DefaultLocale: "en-US" 4 | ManifestType: "version" 5 | ManifestVersion: "1.6.0" 6 | -------------------------------------------------------------------------------- /src/Papercut.Rules/App/Conditional/Forwarding/ConditionalForwardRuleDispatch.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChangemakerStudios/Papercut-SMTP/HEAD/src/Papercut.Rules/App/Conditional/Forwarding/ConditionalForwardRuleDispatch.cs -------------------------------------------------------------------------------- /installation/service/chocolatey/tools/Verification.txt: -------------------------------------------------------------------------------- 1 | VERIFICATION 2 | 3 | Verification is intended to assist the Chocolatey moderators and community in verifying that this package's contents are trustworthy. 4 | 5 | This package is published by the Papercut Project itself. -------------------------------------------------------------------------------- /examples/SendEmailTestWithBadSSL/SendEmailTestWithBadSSL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | true 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /graphics/gear/license.txt: -------------------------------------------------------------------------------- 1 | Thank you for using The Noun Project. This icon is licensed under Creative 2 | Commons Attribution and must be attributed as: 3 | 4 | Gear by Yaroslav Samoilov from The Noun Project 5 | 6 | If you have a Premium Account or have purchased a license for this icon, you 7 | don't need to worry about attribution! We will share the profits from your 8 | purchase with this icon's designer. 9 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.dockerignore 2 | **/.env 3 | **/.git 4 | **/.gitignore 5 | **/.project 6 | **/.settings 7 | **/.toolstarget 8 | **/.vs 9 | **/.vscode 10 | **/.idea 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _ReSharper.Papercut 2 | [Bb]in 3 | [Oo]bj 4 | *.user 5 | *.TeamCity.user 6 | Papercut.suo 7 | Papercut.*.suo 8 | Papercut.ncrunchsolution 9 | Papercut.ncrunchsolution.* 10 | *.hgignore 11 | *.ide 12 | deploy/ 13 | changelog.bat 14 | .vs/ 15 | /build/tools 16 | /tools 17 | out/ 18 | .vscode/ 19 | .idea/ 20 | *.msi 21 | node_modules/ 22 | src/Papercut.UI/publish 23 | src/Papercut.UI/Releases 24 | publish 25 | Releases 26 | .angular 27 | settings.local.json 28 | TestResults/ 29 | .DS_Store 30 | -------------------------------------------------------------------------------- /src/Papercut.Common/Papercut.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" # See documentation for possible values 9 | directory: "/src" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /src/Papercut.Service/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Serilog": { 3 | "MinimumLevel": { 4 | "Default": "Information", 5 | "Override": { 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | }, 11 | 12 | "SmtpServer": { 13 | "IP": "Any", 14 | "Port": 2525, 15 | "MessagePath": "%BaseDirectory%\\Incoming", 16 | "LoggingPath": "%DataDirectory%\\Logs;%BaseDirectory%\\Logs", 17 | "AllowedIps": "*" 18 | }, 19 | 20 | "Urls": "http://0.0.0.0:8080", 21 | 22 | "AllowedHosts": "*" 23 | } -------------------------------------------------------------------------------- /src/Papercut.Service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Papercut", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "detect-port": "^1.2.1", 14 | "electron": "^29.1.1", 15 | "electron-localshortcut": "^3.1.0", 16 | "socket.io": "4.7.4", 17 | "sudo-prompt": "^9.2.1", 18 | "tmp": "^0.2.1" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Papercut.Service/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Serilog": { 3 | "Using": [ "Serilog.Sinks.Seq" ], 4 | "WriteTo": [ 5 | { 6 | "Name": "Seq", 7 | "Args": { "serverUrl": "http://localhost:5341" } 8 | } 9 | ], 10 | "MinimumLevel": { 11 | "Default": "Debug", 12 | "Override": { 13 | "Microsoft": "Information", 14 | "Microsoft.Hosting.Lifetime": "Information" 15 | } 16 | } 17 | }, 18 | 19 | "SmtpServer": { 20 | "Port": 25, 21 | "IP": "127.0.0.1", 22 | "AllowedIps": "*" 23 | }, 24 | 25 | "AllowedHosts": "*", 26 | 27 | "Urls": "http://localhost:37408" 28 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /installation/service/chocolatey/tools/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Papercut 2 | 3 | Copyright © 2008 - 2012 Ken Robertson 4 | Copyright © 2013 - 2018 Jaben Cargman 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.Smtp/Papercut.Infrastructure.Smtp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Papercut.Service/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:49412", // 👈 URL to use with IIS Express profile 8 | "sslPort": 44381 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": false, 16 | "applicationUrl": "http://localhost:5000", // 👈 HTTP-only profile 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Version [e.g. 22] 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /src/Papercut.UI/build-vpk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | 4 | if "%~1"=="" ( 5 | echo Version number is required. 6 | echo Usage: build-vpk.bat [version] 7 | exit /b 1 8 | ) 9 | 10 | set "version=%~1" 11 | 12 | del /s /q .\publish\*.* 13 | del /s /q .\Releases\*.* 14 | 15 | dotnet publish -c Release -r win-x64 -o .\publish\x64 16 | dotnet publish -c Release -r win-x86 -o .\publish\x86 17 | 18 | vpk pack -u PapercutSMTP --packTitle "Papercut SMTP" --runtime win7-x64 --icon App.ico -v %version% -p .\publish\x64 -o .\releases\x64 -e Papercut.exe --framework net8.0-x64-desktop,webview2 19 | vpk pack -u PapercutSMTP-32bit --packTitle "Papercut SMTP 32-bit" --runtime win7-x86 --icon App.ico -v %version% -p .\publish\x86 -o .\releases\x86 -e Papercut.exe --framework net8.0-x64-desktop,webview2 -------------------------------------------------------------------------------- /src/Papercut.UI/ViewModels/IMessageDetailItem.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | namespace Papercut.ViewModels; 19 | 20 | public interface IMessageDetailItem {} -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | global using System.Text; 20 | global using Serilog; 21 | global using JetBrains.Annotations; 22 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 120 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 14 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | Aloha! 14 | I'm ScissorBot :scissors: -- the bot in charge of keeping the issues tidy. 15 | It looks like this issue is stale due to lack of activity. Unfortunately, I'll be closing it if there is no further activity. 😞 16 | Please contribute to the issue to keep it open. 17 | Thanks! 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: false 20 | -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/IOrderable.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Common.Domain; 20 | 21 | public interface IOrderable 22 | { 23 | int Order { get; } 24 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/LifecycleHooks/IAppLifecycleHook.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.LifecycleHooks; 20 | 21 | public interface IAppLifecycleHook 22 | {} -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Message/IFile.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Message; 20 | 21 | public interface IFile 22 | { 23 | string File { get; } 24 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Notification/NewMessagesHub.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Threading.Tasks; 3 | //using Microsoft.AspNetCore.SignalR; 4 | 5 | //namespace Papercut.Service.Web.Notification; 6 | 7 | //public class NewMessagesHub : Hub 8 | //{ 9 | // private readonly ILogger _logger; 10 | // public NewMessagesHub(ILogger logger) 11 | // { 12 | // _logger = logger; 13 | // } 14 | 15 | // public override Task OnDisconnectedAsync(Exception exception) 16 | // { 17 | // _logger.LogInformation($"Connection {Context.ConnectionId} lost."); 18 | // return Task.FromResult(0); 19 | // } 20 | 21 | // public override Task OnConnectedAsync() 22 | // { 23 | // _logger.LogInformation($"New connection {Context.ConnectionId} connected."); 24 | // return Task.FromResult(0); 25 | // } 26 | //} -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/UiCommands/Commands/ShowOptionWindowCommand.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.UiCommands.Commands; 20 | 21 | public class ShowOptionWindowCommand : ICommand 22 | {} -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/ISettingsTyped.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Settings; 20 | 21 | public interface ISettingsTyped 22 | { 23 | ISettingStore Settings { get; set; } 24 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Network/ServiceWebUISettingsExchangeEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Infrastructure.Network; 20 | 21 | public class ServiceWebUISettingsExchangeEvent : BaseBindEvent; -------------------------------------------------------------------------------- /src/Papercut.Service/Domain/ISmtpServerOptionsProvider.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | namespace Papercut.Service.Domain; 19 | 20 | public interface ISmtpServerOptionsProvider 21 | { 22 | SmtpServerSettings Settings { get; } 23 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/BackendService/BackendServiceStatus.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.BackendService; 20 | 21 | public interface IBackendServiceStatus 22 | { 23 | bool IsOnline { get; } 24 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Message/NewMessageEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | 21 | namespace Papercut.Core.Domain.Message; 22 | 23 | public record NewMessageEvent(MessageEntryDto NewMessage) : IEvent; -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Assets/js/message-repository.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | papercutApp.factory('messageRepository', function($http, $q){ 4 | function listMessages(limit, skip){ 5 | var url = '/api/messages?limit='+ limit; 6 | if (limit > 0) { 7 | url += "&start=" + skip; 8 | } 9 | 10 | return $http.get(url); 11 | } 12 | 13 | function getMessage(id){ 14 | return $http.get('/api/messages/' + encodeURIComponent(id)); 15 | } 16 | 17 | function deleteAllMessages(onComplete){ 18 | $http.delete('/api/messages').finally(function () { 19 | onComplete(); 20 | }); 21 | } 22 | 23 | function onNewMessage(){ 24 | // not implemented yet... 25 | } 26 | 27 | return { 28 | list: listMessages, 29 | get: getMessage, 30 | deleteAll: deleteAllMessages, 31 | onNewMessage: onNewMessage 32 | }; 33 | }); -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Application/IAppMeta.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Application; 20 | 21 | public interface IAppMeta 22 | { 23 | string AppName { get; } 24 | 25 | string AppVersion { get; } 26 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Network/Smtp/SmtpServerForceRebindEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | 21 | namespace Papercut.Core.Domain.Network.Smtp; 22 | 23 | public class SmtpServerForceRebindEvent : IEvent 24 | {} -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/LifecycleHooks/AppLifecycleActionResultType.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.LifecycleHooks; 20 | 21 | public enum AppLifecycleActionResultType 22 | { 23 | Continue = 1, 24 | Cancel = 10 25 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/LifecycleHooks/IAppLifecycleStarted.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.LifecycleHooks; 20 | 21 | public interface IAppLifecycleStarted : IAppLifecycleHook 22 | { 23 | Task OnStartedAsync(); 24 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Container/ContainerScope.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Infrastructure.Container; 20 | 21 | public static class ContainerScope 22 | { 23 | public static readonly object UIScopeTag = new(); 24 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Hosting/PapercutWebServerReadyEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Web.Hosting; 20 | 21 | public class PapercutWebServerReadyEvent : IEvent 22 | { 23 | public HttpClient? HttpClient { get; set; } 24 | } -------------------------------------------------------------------------------- /test/Papercut.Rules.Tests/Papercut.Rules.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Papercut.Service/start-electron-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$1" != "nobuild" ]; then 6 | # we need to use this command to 'build' an Electron.NET app. (But actually, we don't need to run it at this time; however, Electron.NET does not provide a switch for prevent running) 7 | echo 'rebuilding electron app... (To sktip rebuilding, just add 'nobuild' as an argument)' 8 | electronize start 9 | fi 10 | 11 | # On lanching, we need to quit Papercut app once manually. (The app is launched automatically by Electron.NET start command...) 12 | # Because the our main.js is not applied before we execute following scripts: 13 | 14 | cp -f obj/Host/bin/main.js obj/Host/main.js 15 | cp -f obj/Host/bin/package.json obj/Host/package.json 16 | cp -f obj/Host/bin/launch.sh obj/Host/launch.sh 17 | cd obj/Host/ 18 | npm install 19 | cd ./node_modules/.bin/ 20 | 21 | # Run the app after the main.js is replaced 22 | ./electron ../../main.js -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/ISettingStore.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Settings; 20 | 21 | public interface ISettingStore : IReadValue, IWriteValue 22 | { 23 | void Load(); 24 | 25 | void Save(); 26 | } -------------------------------------------------------------------------------- /test/Papercut.Infrastructure.Smtp.Tests/Papercut.Infrastructure.Smtp.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 4.4.0 14 | 15 | 16 | 5.2.0 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/Papercut.Message.Tests/Papercut.Message.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/LifecycleHooks/IAppLifecyclePreExit.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.LifecycleHooks; 20 | 21 | public interface IAppLifecyclePreExit : IAppLifecycleHook 22 | { 23 | Task OnPreExit(); 24 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/LifecycleHooks/IAppLifecyclePreStart.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.LifecycleHooks; 20 | 21 | public interface IAppLifecyclePreStart : IAppLifecycleHook 22 | { 23 | Task OnPreStart(); 24 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Network/AppProcessExchangeEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Infrastructure.Network; 20 | 21 | public class AppProcessExchangeEvent : BaseBindEvent 22 | { 23 | public string? MessageWritePath { get; set; } 24 | } -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Common.Domain; 20 | 21 | public interface IEventHandler 22 | where TEvent : IEvent 23 | { 24 | Task HandleAsync(TEvent @event, CancellationToken token = default); 25 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/AppCommands/IAppCommandHub.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.AppCommands; 20 | 21 | public interface IAppCommandHub 22 | { 23 | IObservable OnShutdown { get; } 24 | 25 | void Shutdown(int exitCode = 0); 26 | } -------------------------------------------------------------------------------- /src/Papercut.Rules/Domain/Conditional/IConditionalRule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Rules.Domain.Conditional; 20 | 21 | public interface IConditionalRule 22 | { 23 | string RegexHeaderMatch { get; set; } 24 | 25 | string RegexBodyMatch { get; set; } 26 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Rules/RulesUpdatedEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | 21 | namespace Papercut.Core.Domain.Rules; 22 | 23 | public class RulesUpdatedEvent(IRule[] rules) : IEvent 24 | { 25 | public IRule[] Rules { get; set; } = rules; 26 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MainView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | public partial class MainView : MetroWindow 22 | { 23 | public MainView() 24 | { 25 | this.AutoAdjustBorders(); 26 | this.InitializeComponent(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/ForwardView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | public partial class ForwardView : MetroWindow 22 | { 23 | public ForwardView() 24 | { 25 | this.AutoAdjustBorders(); 26 | this.InitializeComponent(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/OptionsView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | public partial class OptionsView : MetroWindow 22 | { 23 | public OptionsView() 24 | { 25 | this.AutoAdjustBorders(); 26 | this.InitializeComponent(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Papercut.Infrastructure.IPComm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 8.3.0 17 | 18 | 19 | 13.0.3 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Papercut.Rules/Papercut.Rules.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Papercut.Common/Domain/ICommandHandler.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Common.Domain; 20 | 21 | public interface ICommandHandler 22 | where TCommand : ICommand 23 | { 24 | Task ExecuteAsync(TCommand @command, CancellationToken token = default); 25 | } -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/NewVersionCheck/INewVersionProvider.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Velopack; 20 | 21 | namespace Papercut.AppLayer.NewVersionCheck; 22 | 23 | public interface INewVersionProvider 24 | { 25 | Task GetLatestVersionAsync(CancellationToken token = default); 26 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Network/BaseBindEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | 21 | namespace Papercut.Core.Infrastructure.Network; 22 | 23 | public class BaseBindEvent : IEvent 24 | { 25 | public string? IP { get; set; } 26 | 27 | public int? Port { get; set; } 28 | } -------------------------------------------------------------------------------- /test/Papercut.Core.Tests/Papercut.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 13.0.4 14 | 15 | 16 | 4.4.0 17 | 18 | 19 | 5.2.0 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Papercut.Rules/Domain/Rules/IRuleRepository.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Core.Domain.Rules; 20 | 21 | namespace Papercut.Rules.Domain.Rules; 22 | 23 | public interface IRuleRepository 24 | { 25 | void SaveRules(IList rules, string path); 26 | 27 | IList LoadRules(string path); 28 | } -------------------------------------------------------------------------------- /src/Papercut.Service/start-electron-app.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | 4 | 5 | rem we need to use this command to 'build' an Electron.NET app. (But actually, we don't need to run it at this time; however, Electron.NET does not provide a switch for prevent running) 6 | if NOT "%1"=="nobuild" ( 7 | echo rebuilding electron app... (To sktip rebuilding, just add 'nobuild' as an argument ^^^) 8 | electronize start 9 | ) 10 | 11 | 12 | rem On lanching, we need to quit Papercut app once manually. (The app is launched automatically by Electron.NET start command...) 13 | rem Because the our main.js is not applied before we execute following scripts: 14 | 15 | copy /Y obj\Host\bin\main.js obj\Host\main.js 16 | copy /Y obj\Host\bin\package.json obj\Host\package.json 17 | copy /Y obj\Host\bin\launch.sh obj\Host\launch.sh 18 | 19 | cd obj\Host\ 20 | call npm install 21 | 22 | 23 | rem Run the app after the main.js is replaced 24 | echo launching the Papercut desktop app... 25 | .\node_modules\electron\dist\electron.exe ".\main.js" -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/AppCommands/ShutdownCommand.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.AppCommands; 20 | 21 | public class ShutdownCommand : ICommand 22 | { 23 | public ShutdownCommand(int exitCode) 24 | { 25 | this.ExitCode = exitCode; 26 | } 27 | 28 | public int ExitCode { get; } 29 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/UiCommands/Commands/ShowMainWindowCommand.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.UiCommands.Commands; 20 | 21 | public class ShowMainWindowCommand(bool selectMostRecentMessage = false) : IEvent 22 | { 23 | public bool SelectMostRecentMessage { get; set; } = selectMostRecentMessage; 24 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/WireupLogBridge.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Helpers; 20 | 21 | public class WireupLogBridge : IStartable 22 | { 23 | public void Start() 24 | { 25 | LogManager.GetLog = 26 | type => new CalburnSerilogBridge(new Lazy(() => Log.ForContext(type))); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Lifecycle/PapercutClientReadyEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | using Papercut.Core.Domain.Application; 21 | 22 | namespace Papercut.Core.Infrastructure.Lifecycle; 23 | 24 | public class PapercutClientReadyEvent : IEvent 25 | { 26 | public IAppMeta? AppMeta { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Lifecycle/PapercutServicePreStartEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Domain; 20 | using Papercut.Core.Domain.Application; 21 | 22 | namespace Papercut.Core.Infrastructure.Lifecycle; 23 | 24 | public class PapercutServicePreStartEvent : IEvent 25 | { 26 | public IAppMeta? AppMeta { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Rules/IRuleDispatcher.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright � 2008 - 2012 Ken Robertson 4 | // Copyright � 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Core.Domain.Message; 20 | 21 | namespace Papercut.Core.Domain.Rules; 22 | 23 | public interface IRuleDispatcher 24 | where TRule : IRule 25 | { 26 | Task DispatchAsync(TRule rule, MessageEntry? messageEntry = null, CancellationToken token = default); 27 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Events/ThemeChangedEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Windows.Media; 20 | 21 | namespace Papercut.Domain.Events; 22 | 23 | public class ThemeChangedEvent(bool isDarkMode, Color themeColor) : IEvent 24 | { 25 | public bool IsDarkMode { get; } = isDarkMode; 26 | 27 | public Color ThemeColor { get; } = themeColor; 28 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/UiCommands/Commands/ShowMessageCommand.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.UiCommands.Commands; 20 | 21 | public class ShowMessageCommand(string messageText, string caption) : ICommand 22 | { 23 | public string MessageText { get; set; } = messageText; 24 | 25 | public string Caption { get; set; } = caption; 26 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageListView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageListView.xaml 23 | /// 24 | public partial class MessageListView : UserControl 25 | { 26 | public MessageListView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/HtmlPreviews/IHtmlPreviewGenerator.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.HtmlPreviews; 20 | 21 | public interface IHtmlPreviewGenerator 22 | { 23 | string GetHtmlPreview(MimeMessage? mailMessageEx, string? tempDir = null); 24 | 25 | string? GetHtmlPreviewFile(MimeMessage? mailMessageEx, string? tempDir = null); 26 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Message/NewMessageEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Message; 20 | 21 | public class NewMessageEventArgs : EventArgs 22 | { 23 | public NewMessageEventArgs(MessageEntry newMessage) 24 | { 25 | this.NewMessage = newMessage; 26 | } 27 | 28 | public MessageEntry NewMessage { get; set; } 29 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Network/PapercutIPCommRequest.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright � 2008 - 2012 Ken Robertson 4 | // Copyright � 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Infrastructure.IPComm.Network; 20 | 21 | public class PapercutIPCommRequest 22 | { 23 | public PapercutIPCommCommandType CommandType { get; set; } 24 | 25 | public required Type Type { get; set; } 26 | 27 | public int ByteSize { get; set; } 28 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailView.xaml 23 | /// 24 | public partial class MessageDetailView : UserControl 25 | { 26 | public MessageDetailView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailRawView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailRawView.xaml 23 | /// 24 | public partial class MessageDetailRawView : UserControl 25 | { 26 | public MessageDetailRawView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailBodyView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailBodyView.xaml 23 | /// 24 | public partial class MessageDetailBodyView : UserControl 25 | { 26 | public MessageDetailBodyView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.Rules/PapercutRuleModule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac; 20 | 21 | using Papercut.Core.Infrastructure.Container; 22 | 23 | namespace Papercut.Rules; 24 | 25 | public class PapercutRuleModule : Module 26 | { 27 | protected override void Load(ContainerBuilder builder) 28 | { 29 | builder.RegisterStaticMethods(this.ThisAssembly); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailHtmlView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailHtmlView.xaml 23 | /// 24 | public partial class MessageDetailHtmlView : UserControl 25 | { 26 | public MessageDetailHtmlView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MimePartView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MimePartView.xaml 23 | /// 24 | public partial class MimePartView : MetroWindow 25 | { 26 | public MimePartView() 27 | { 28 | this.AutoAdjustBorders(); 29 | this.InitializeComponent(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Network/Smtp/SmtpServerBindEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Core.Infrastructure.Network; 20 | 21 | namespace Papercut.Core.Domain.Network.Smtp; 22 | 23 | public class SmtpServerBindEvent : BaseBindEvent 24 | { 25 | public SmtpServerBindEvent(string ip, int port) 26 | { 27 | this.IP = ip; 28 | this.Port = port; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Events/SettingsUpdatedEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.Events; 20 | 21 | public class SettingsUpdatedEvent(Settings previousSettings, Settings? newSettings = null) : IEvent 22 | { 23 | public Settings PreviousSettings { get; } = previousSettings; 24 | 25 | public Settings NewSettings { get; } = newSettings ?? Settings.Default; 26 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailHeaderView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailHeaderView.xaml 23 | /// 24 | public partial class MessageDetailHeaderView : UserControl 25 | { 26 | public MessageDetailHeaderView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailPartsListView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for MessageDetailPartsListView.xaml 23 | /// 24 | public partial class MessageDetailPartsListView : UserControl 25 | { 26 | public MessageDetailPartsListView() 27 | { 28 | this.InitializeComponent(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.Common/Helper/AssemblyHelper.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reflection; 20 | 21 | namespace Papercut.Common.Helper; 22 | 23 | public static class AssemblyHelper 24 | { 25 | public static string? GetVersion(this Assembly assembly) 26 | { 27 | ArgumentNullException.ThrowIfNull(assembly); 28 | 29 | return assembly.GetName()?.Version?.ToString(4); 30 | } 31 | } -------------------------------------------------------------------------------- /examples/SmtpSendOptions.cs: -------------------------------------------------------------------------------- 1 | using MailKit.Security; 2 | 3 | namespace Papercut.Examples; 4 | 5 | /// 6 | /// Configuration options for SMTP sending in example applications 7 | /// 8 | public class SmtpSendOptions 9 | { 10 | /// 11 | /// SMTP server hostname or IP address (default: 127.0.0.1) 12 | /// 13 | public string Host { get; set; } = "127.0.0.1"; 14 | 15 | /// 16 | /// SMTP server port (default: 25) 17 | /// Common ports: 25 (plain), 587 (STARTTLS), 465 (TLS) 18 | /// 19 | public int Port { get; set; } = 25; 20 | 21 | /// 22 | /// Security mode for SMTP connection 23 | /// 24 | public SecureSocketOptions Security { get; set; } = SecureSocketOptions.None; 25 | 26 | /// 27 | /// Username for SMTP authentication (optional) 28 | /// 29 | public string? Username { get; set; } 30 | 31 | /// 32 | /// Password for SMTP authentication (optional) 33 | /// 34 | public string? Password { get; set; } 35 | } 36 | -------------------------------------------------------------------------------- /installation/winget/ChangemakerStudios.PapercutSMTP.installer.yaml: -------------------------------------------------------------------------------- 1 | PackageIdentifier: "ChangemakerStudios.PapercutSMTP" 2 | PackageVersion: "7.6.2" 3 | Platform: 4 | - "Windows.Desktop" 5 | MinimumOSVersion: "10.0.17763.0" 6 | InstallerType: "exe" 7 | Scope: "user" 8 | InstallModes: 9 | - "silent" 10 | InstallerSwitches: 11 | Silent: "--silent" 12 | SilentWithProgress: "--silent" 13 | UpgradeBehavior: "install" 14 | Installers: 15 | - Architecture: "x64" 16 | InstallerUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/releases/download/7.6.2/PapercutSMTP-win-x64-stable-Setup.exe" 17 | InstallerSha256: "" 18 | - Architecture: "x86" 19 | InstallerUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/releases/download/7.6.2/PapercutSMTP-win-x86-stable-Setup.exe" 20 | InstallerSha256: "" 21 | - Architecture: "arm64" 22 | InstallerUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/releases/download/7.6.2/PapercutSMTP-win-arm64-stable-Setup.exe" 23 | InstallerSha256: "" 24 | ManifestType: "installer" 25 | ManifestVersion: "1.6.0" 26 | -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Paths/IPathTemplatesProvider.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Collections.ObjectModel; 20 | 21 | namespace Papercut.Core.Domain.Paths; 22 | 23 | public enum PathTemplateType 24 | { 25 | Message, 26 | Logging 27 | } 28 | 29 | public interface IPathTemplatesProvider 30 | { 31 | ObservableCollection PathTemplates { get; } 32 | 33 | PathTemplateType Type { get; } 34 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/RulesConfigurationView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Views; 20 | 21 | /// 22 | /// Interaction logic for RulesConfigurationView.xaml 23 | /// 24 | public partial class RulesConfigurationView : MetroWindow 25 | { 26 | public RulesConfigurationView() 27 | { 28 | this.AutoAdjustBorders(); 29 | this.InitializeComponent(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Application/Controllers/GetMessagesResponse.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Application.Controllers; 20 | 21 | public class GetMessagesResponse(int totalMessageCount, IEnumerable messages) 22 | { 23 | public int TotalMessageCount { get; } = totalMessageCount; 24 | 25 | public List Messages { get; } = messages.IfNullEmpty().ToList(); 26 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Events/PapercutServiceStatusEvent.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.Events; 20 | 21 | public class PapercutServiceStatusEvent(PapercutServiceStatusType papercutServiceStatus) : IEvent 22 | { 23 | public PapercutServiceStatusType PapercutServiceStatus { get; } = papercutServiceStatus; 24 | } 25 | 26 | public enum PapercutServiceStatusType 27 | { 28 | Offline = 0, 29 | Online = 1 30 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Rules/IRulesRunner.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Core.Domain.Message; 20 | 21 | namespace Papercut.Core.Domain.Rules; 22 | 23 | public interface IRulesRunner 24 | { 25 | Task RunNewMessageRules(INewMessageRule[] rules, MessageEntry messageEntry, CancellationToken token = default); 26 | 27 | Task RunPeriodicBackgroundRules(IPeriodicBackgroundRule[] rules, CancellationToken token = default); 28 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.Smtp/SimpleAuthentication.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using SmtpServer; 20 | using SmtpServer.Authentication; 21 | 22 | namespace Papercut.Infrastructure.Smtp; 23 | 24 | public class SimpleAuthentication : IUserAuthenticatorFactory 25 | { 26 | public IUserAuthenticator CreateInstance(ISessionContext context) 27 | { 28 | return new DelegatingUserAuthenticator((username, password) => true); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Papercut.Message/IMimeMessageLoader.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using MimeKit; 20 | 21 | using Papercut.Core.Domain.Message; 22 | 23 | namespace Papercut.Message; 24 | 25 | public interface IMimeMessageLoader 26 | { 27 | void GetMessageCallback( 28 | MessageEntry messageEntry, 29 | Action callback); 30 | 31 | Task GetAsync(MessageEntry messageEntry, CancellationToken token = default); 32 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Application/ApplicationMeta.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reflection; 20 | 21 | namespace Papercut.Core.Domain.Application; 22 | 23 | public class ApplicationMeta(string appName, string? appVersion = null) : IAppMeta 24 | { 25 | public string AppName { get; } = appName; 26 | 27 | public string AppVersion { get; } = appVersion ?? Assembly.GetCallingAssembly().GetName().Version?.ToString(3) ?? "1.0.0.0"; 28 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Network/PapercutIPCommConstants.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Infrastructure.IPComm.Network; 20 | 21 | public static class PapercutIPCommConstants 22 | { 23 | public const ushort UiListeningPort = 37402; 24 | 25 | public const ushort ServiceListeningPort = 37403; 26 | 27 | public const ushort TrayServiceListeningPort = 37404; 28 | 29 | public const string Localhost = "127.0.0.1"; 30 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Domain/SmtpServer/SmtpServerSettings.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Domain.SmtpServer; 20 | 21 | public record SmtpServerSettings( 22 | string IP, 23 | int Port, 24 | string CertificateFindType, 25 | string CertificateFindValue, 26 | string CertificateStoreLocation, 27 | string CertificateStoreName, 28 | string MessagePath, 29 | string LoggingPath, 30 | string AllowedIps); -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Application/PapercutAppConstants.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.Application; 20 | 21 | public static class PapercutAppConstants 22 | { 23 | internal static string Name => "Papercut.Smtp.App"; 24 | 25 | internal static string LegacyName => "Papercut.App"; 26 | 27 | internal static string ExecutablePath { get; } = 28 | Assembly.GetExecutingAssembly().Location.Replace(".dll", ".exe"); 29 | } -------------------------------------------------------------------------------- /src/Papercut.Message/Papercut.Message.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 8.3.0 17 | 18 | 19 | 4.12.1 20 | 21 | 22 | 23 | 4.12.0 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/BackgroundTasks/IBackgroundTaskRunner.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2024 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.BackgroundTasks; 20 | 21 | public interface IBackgroundTaskRunner 22 | { 23 | /// 24 | /// Queues a background task to be executed. 25 | /// 26 | /// An asynchronous function representing the task. 27 | void QueueBackgroundTask(Func taskFunc); 28 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Rules/IRule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright � 2008 - 2012 Ken Robertson 4 | // Copyright � 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.ComponentModel; 20 | 21 | namespace Papercut.Core.Domain.Rules; 22 | 23 | public interface INewMessageRule : IRule { } 24 | 25 | public interface IPeriodicBackgroundRule : IRule { } 26 | 27 | public interface IRule : INotifyPropertyChanged 28 | { 29 | Guid Id { get; } 30 | 31 | bool IsEnabled { get; set; } 32 | 33 | string Type { get; } 34 | 35 | string Description { get; } 36 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Application/Controllers/HealthController.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Application.Controllers; 20 | 21 | public class HealthController : ControllerBase 22 | { 23 | [HttpGet("health")] 24 | public IActionResult Check() 25 | { 26 | return new ContentResult 27 | { 28 | Content = "Papercut WebUI server started successfully.", 29 | ContentType = "text/plain" 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Papercut.Common/Helper/PathHelpers.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reflection; 20 | 21 | namespace Papercut.Common.Helper; 22 | 23 | public static class PathHelpers 24 | { 25 | public static string? GetPath(this Assembly assembly) 26 | { 27 | if (assembly == null) throw new ArgumentNullException(nameof(assembly)); 28 | 29 | string filePath = new Uri(assembly.Location).LocalPath; 30 | 31 | return Path.GetDirectoryName(filePath); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Message/MessageEntryDto.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Message; 20 | 21 | public class MessageEntryDto 22 | { 23 | public DateTime ModifiedDate { get; init; } 24 | 25 | public required string File { get; init; } 26 | 27 | public string? Name { get; init; } 28 | 29 | public string? FileSize { get; init; } 30 | 31 | public string? DisplayText { get; init; } 32 | 33 | public MessageEntry ToEntry() => new(File); 34 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/HandlebarHelpers.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using HandlebarsDotNet; 20 | 21 | namespace Papercut.Helpers; 22 | 23 | public static class HandlebarHelpers 24 | { 25 | public static string RenderTemplate(this string template, object model) 26 | { 27 | ArgumentNullException.ThrowIfNull(template); 28 | ArgumentNullException.ThrowIfNull(model); 29 | 30 | var hbt = Handlebars.Compile(template); 31 | 32 | return hbt(model); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/Themes.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Helpers; 20 | 21 | public enum Themes 22 | { 23 | Red, 24 | Green, 25 | Blue, 26 | Purple, 27 | Orange, 28 | Lime, 29 | Emerald, 30 | Teal, 31 | Cyan, 32 | Cobalt, 33 | Indigo, 34 | Violet, 35 | Pink, 36 | Magenta, 37 | Crimson, 38 | Amber, 39 | Yellow, 40 | Brown, 41 | Olive, 42 | Steel, 43 | Mauve, 44 | Taupe, 45 | Sienna 46 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Models/MessageDetail.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Web.Models; 20 | 21 | public class MessageDetail 22 | { 23 | public string? Subject { get; set; } 24 | 25 | public string? From { get; set; } 26 | 27 | public string? To { get; set; } 28 | 29 | public string? Cc { get; set; } 30 | 31 | public string? Bcc { get; set; } 32 | 33 | public string? BodyContent { get; set; } 34 | 35 | public bool IsBodyHtml { get; set; } 36 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | [assembly: ThemeInfo( 20 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 21 | //(used if a resource is not found in the page, 22 | // or application resource dictionaries) 23 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 24 | //(used if a resource is not found in the page, 25 | // app, or any theme specific resource dictionaries) 26 | )] 27 | -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Logging/LoggerExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Infrastructure.Logging; 20 | 21 | public static class LoggerExtensions 22 | { 23 | public static bool ErrorWithContext(this ILogger logger, Exception? exception, string message, params object?[] propertyValues) 24 | { 25 | if (logger == null) throw new ArgumentNullException(nameof(logger)); 26 | 27 | logger.Error(exception, message, propertyValues); 28 | 29 | return true; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Container/SimpleContainer.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac; 20 | using Autofac.Core; 21 | 22 | namespace Papercut.Core.Infrastructure.Container; 23 | 24 | public class SimpleContainer 25 | where TModule : IModule, new() 26 | { 27 | public IContainer Build() 28 | { 29 | var builder = new ContainerBuilder(); 30 | 31 | builder.RegisterModule(); 32 | builder.RegisterModule(); 33 | 34 | return builder.Build(); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailHeaderView.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/Themes/BaseTheme.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Domain.Themes; 20 | 21 | /// 22 | /// Represents the base theme (light/dark) selection mode 23 | /// 24 | public enum BaseTheme 25 | { 26 | /// 27 | /// Synchronize with system theme 28 | /// 29 | System, 30 | 31 | /// 32 | /// Always use light theme 33 | /// 34 | Light, 35 | 36 | /// 37 | /// Always use dark theme 38 | /// 39 | Dark 40 | } 41 | -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Consoles/ConsoleHelpers.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Infrastructure.Consoles; 20 | 21 | public static class ConsoleHelpers 22 | { 23 | public static bool HasConsole() 24 | { 25 | if (!Environment.UserInteractive) 26 | { 27 | return false; 28 | } 29 | 30 | try 31 | { 32 | _ = Console.WindowHeight; 33 | return true; 34 | } 35 | catch 36 | { 37 | return false; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Network/IServer.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Net; 20 | 21 | namespace Papercut.Core.Domain.Network; 22 | 23 | /// 24 | /// The Server interface. 25 | /// 26 | public interface IServer : IDisposable, IAsyncDisposable 27 | { 28 | bool IsActive { get; } 29 | 30 | IPAddress? ListenIpAddress { get; } 31 | 32 | int ListenPort { get; } 33 | 34 | Task StartAsync(EndpointDefinition endpoint, CancellationToken token = default); 35 | 36 | Task StopAsync(CancellationToken token = default); 37 | } -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/Papercut.Service.TrayNotification.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Papercut SMTP Service Tray Manager 5 | WinExe 6 | net9.0-windows 7 | icons\Papercut-icon.ico 8 | app.manifest 9 | true 10 | enable 11 | enable 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /installation/service/install-papercut-service.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM Papercut SMTP Service - Installation Script 3 | REM This batch file wrapper runs the PowerShell installation script 4 | 5 | echo. 6 | echo ======================================== 7 | echo Papercut SMTP Service - Installation 8 | echo ======================================== 9 | echo. 10 | 11 | REM Get the directory where this script is located 12 | set "SCRIPT_DIR=%~dp0" 13 | 14 | REM Check if PowerShell script exists 15 | if not exist "%SCRIPT_DIR%install-papercut-service.ps1" ( 16 | echo ERROR: Could not find install-papercut-service.ps1 17 | echo Please ensure the PowerShell script is in the same directory as this batch file. 18 | echo. 19 | pause 20 | exit /b 1 21 | ) 22 | 23 | REM Run the PowerShell script with elevated privileges 24 | echo Running installation script... 25 | echo. 26 | powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%install-papercut-service.ps1" 27 | 28 | REM Check if PowerShell execution failed 29 | if errorlevel 1 ( 30 | echo. 31 | echo ERROR: Installation script failed to execute. 32 | echo Please ensure you have PowerShell installed and try running as Administrator. 33 | echo. 34 | pause 35 | exit /b 1 36 | ) 37 | 38 | exit /b 0 39 | -------------------------------------------------------------------------------- /src/Papercut.Common/Helper/RegexHelpers.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Text.RegularExpressions; 20 | 21 | namespace Papercut.Common.Helper; 22 | 23 | public static class RegexHelpers 24 | { 25 | public static bool IsValidRegex(this string regexString) 26 | { 27 | if (!regexString.IsSet()) 28 | return false; 29 | 30 | try 31 | { 32 | var regex = new Regex(regexString); 33 | return true; 34 | } 35 | catch (ArgumentException) 36 | { 37 | } 38 | 39 | return false; 40 | } 41 | } -------------------------------------------------------------------------------- /installation/service/uninstall-papercut-service.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM Papercut SMTP Service - Uninstallation Script 3 | REM This batch file wrapper runs the PowerShell uninstallation script 4 | 5 | echo. 6 | echo ======================================== 7 | echo Papercut SMTP Service - Uninstallation 8 | echo ======================================== 9 | echo. 10 | 11 | REM Get the directory where this script is located 12 | set "SCRIPT_DIR=%~dp0" 13 | 14 | REM Check if PowerShell script exists 15 | if not exist "%SCRIPT_DIR%uninstall-papercut-service.ps1" ( 16 | echo ERROR: Could not find uninstall-papercut-service.ps1 17 | echo Please ensure the PowerShell script is in the same directory as this batch file. 18 | echo. 19 | pause 20 | exit /b 1 21 | ) 22 | 23 | REM Run the PowerShell script with elevated privileges 24 | echo Running uninstallation script... 25 | echo. 26 | powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%uninstall-papercut-service.ps1" 27 | 28 | REM Check if PowerShell execution failed 29 | if errorlevel 1 ( 30 | echo. 31 | echo ERROR: Uninstallation script failed to execute. 32 | echo Please ensure you have PowerShell installed and try running as Administrator. 33 | echo. 34 | pause 35 | exit /b 1 36 | ) 37 | 38 | exit /b 0 39 | -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/MailMessageHelper.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Net.Mail; 20 | 21 | namespace Papercut.Helpers; 22 | 23 | public static class MailMessageHelper 24 | { 25 | public static MailMessage CreateFailureMailMessage(string error) 26 | { 27 | var errorMessage = new MailMessage 28 | { 29 | From = new MailAddress("fail@papercut.com", "Papercut Failure"), 30 | Subject = "Failure loading message: " + error, 31 | Body = "Unable to load", 32 | IsBodyHtml = false 33 | }; 34 | 35 | return errorMessage; 36 | } 37 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Web/FileHelper.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Service.Web; 20 | 21 | internal class FileHelper 22 | { 23 | public static string NormalizeFilename(string filename) 24 | { 25 | var validFilename = RemoveInvalidFileNameChars(filename); 26 | return validFilename.Replace(" ", "_"); 27 | } 28 | 29 | private static string RemoveInvalidFileNameChars(string filename) 30 | { 31 | return Path.GetInvalidFileNameChars().Aggregate(filename, 32 | (current, invalidChar) => current.Replace(invalidChar.ToString(), string.Empty)); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Infrastructure/Container/AutofacServiceProvider.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Infrastructure.Container; 20 | 21 | public class AutofacServiceProvider(ILifetimeScope lifetimeScope) : IServiceProvider 22 | { 23 | public object GetService(Type serviceType) 24 | { 25 | return lifetimeScope.Resolve(serviceType); 26 | } 27 | 28 | #region Begin Static Container Registrations 29 | 30 | [UsedImplicitly] 31 | static void Register(ContainerBuilder builder) 32 | { 33 | builder.RegisterType().As(); 34 | } 35 | 36 | #endregion 37 | } -------------------------------------------------------------------------------- /src/Papercut.Message/IMessageRepository.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Core.Domain.Message; 20 | 21 | namespace Papercut.Message; 22 | 23 | public interface IMessageRepository 24 | { 25 | bool DeleteMessage(MessageEntry entry); 26 | 27 | Task GetMessage(string? file); 28 | 29 | /// 30 | /// Loads all messages 31 | /// 32 | IEnumerable LoadMessages(); 33 | 34 | string GetFullMailFilename(string mailSubject); 35 | 36 | Task SaveMessage(string mailSubject, Func writeTo); 37 | 38 | static string MessageFileSearchPattern => "*.eml"; 39 | } -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Behaviors/InteractivityBlurOnDisabled.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.AppLayer.Behaviors; 20 | 21 | public class InteractivityBlurOnDisabled : InteractivityBlurBase 22 | { 23 | protected override void OnAttached() 24 | { 25 | base.OnAttached(); 26 | this.AssociatedObject.IsEnabledChanged += this.AssociatedObjectIsEnabledChanged; 27 | } 28 | 29 | void AssociatedObjectIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) 30 | { 31 | this.AssociatedObject.Effect = this.AssociatedObject.IsEnabled 32 | ? null 33 | : this.GetBlurEffect(); 34 | } 35 | } -------------------------------------------------------------------------------- /src/Papercut.Common/Extensions/OrderableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | using Papercut.Common.Domain; 19 | 20 | namespace Papercut.Common.Extensions; 21 | 22 | public static class OrderableExtensions 23 | { 24 | public static IReadOnlyCollection MaybeByOrderable(this IEnumerable items) 25 | { 26 | return items.IfNullEmpty().Distinct() 27 | .Select((e, i) => new { Index = 100 + i, Item = e }).OrderBy( 28 | e => 29 | { 30 | var orderable = e.Item as IOrderable; 31 | return orderable?.Order ?? e.Index; 32 | }).Select(e => e.Item).ToReadOnlyCollection(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/ZoomIndicator.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | Changemaker Studios 4 | Standalone SMTP server designed for viewing received messages 5 | Copyright © 2008 - 2025 Ken Robertson & Jaben Cargman 6 | AnyCPU;x86;x64 7 | portable 8 | enable 9 | enable 10 | true 11 | true 12 | NU1605 13 | 14 | 15 | 16 | 17 | 1.0.0 18 | $(Version) 19 | $(Version) 20 | $(Version) 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Papercut.UI/Views/MessageDetailBodyView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/UiCommands/Commands/ShowBalloonTipCommand.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Windows.Forms; 20 | 21 | namespace Papercut.Domain.UiCommands.Commands; 22 | 23 | public class ShowBalloonTipCommand : ICommand 24 | { 25 | public ShowBalloonTipCommand(int timeout, string tipTitle, string tipText, ToolTipIcon toolTipIcon) 26 | { 27 | this.Timeout = timeout; 28 | this.TipTitle = tipTitle; 29 | this.TipText = tipText; 30 | this.ToolTipIcon = toolTipIcon; 31 | } 32 | 33 | public int Timeout { get; set; } 34 | 35 | public string TipTitle { get; set; } 36 | 37 | public string TipText { get; set; } 38 | 39 | public ToolTipIcon ToolTipIcon { get; set; } 40 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Infrastructure/Logging/AddReadFromConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Microsoft.Extensions.Configuration; 20 | 21 | using Serilog.Configuration; 22 | 23 | namespace Papercut.Service.Infrastructure.Logging; 24 | 25 | public class AddReadFromConfiguration(IConfiguration configuration) : ILoggerSettings 26 | { 27 | public void Configure(LoggerConfiguration loggerConfiguration) 28 | { 29 | loggerConfiguration.ReadFrom.Configuration(configuration); 30 | } 31 | 32 | #region Begin Static Container Registrations 33 | 34 | static void Register(ContainerBuilder builder) 35 | { 36 | builder.RegisterType().As(); 37 | } 38 | 39 | #endregion 40 | } -------------------------------------------------------------------------------- /installation/service/chocolatey/tools/chocolateyInstall.ps1: -------------------------------------------------------------------------------- 1 | $packageName = 'Papercut.Service' 2 | $serviceName = "XSockets-4.0.0" 3 | Write-Host "Installing Windows Service: $($packageName)" 4 | # verify if the service already exists, and if yes remove it first 5 | if (Get-Service $serviceName -ErrorAction SilentlyContinue) 6 | { 7 | # using WMI to remove Windows service because PowerShell does not have CmdLet for this 8 | $serviceToRemove = Get-WmiObject -Class Win32_Service -Filter "name='$serviceName'" 9 | #Stop-Service $serviceName 10 | $serviceToRemove.delete() 11 | Write-Host "service $($packageName) removed" 12 | } 13 | else 14 | { 15 | # just do nothing 16 | Write-Host "service $($packageName) does not exists" 17 | } 18 | 19 | Write-Host "installing $($packageName) service from $(Split-Path $MyInvocation.MyCommand.Path))" 20 | # creating credentials which can be used to run my windows service 21 | #$secpasswd = ConvertTo-SecureString "MyPa$$word" -AsPlainText -Force 22 | #$mycreds = New-Object System.Management.Automation.PSCredential (".\MyUserName", $secpasswd) 23 | $binaryPath = "$(Split-Path $MyInvocation.MyCommand.Path)\XSockets.Windows.Service.exe" 24 | # creating windows service using all provided parameters 25 | New-Service -name $serviceName -binaryPathName $binaryPath -displayName $serviceName -startupType Automatic 26 | #-credential $mycreds 27 | #Start-Service $serviceName 28 | Write-Host "$($packageName) installation completed" -------------------------------------------------------------------------------- /src/Papercut.Rules/Infrastructure/ObservableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reactive.Linq; 20 | 21 | namespace Papercut.Rules.Infrastructure; 22 | 23 | public static class ObservableExtensions 24 | { 25 | public static IObservable RetryWithDelay(this IObservable source, int retryCount, TimeSpan timeSpan) 26 | { 27 | if (source == null) 28 | throw new ArgumentNullException(nameof(source)); 29 | if (timeSpan < TimeSpan.Zero) 30 | throw new ArgumentOutOfRangeException(nameof(timeSpan)); 31 | if (timeSpan == TimeSpan.Zero) 32 | return source.Retry(retryCount); 33 | 34 | return source.Catch(Observable.Timer(timeSpan).SelectMany(_ => source).Retry(retryCount)); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/IViewModelWindowManager.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Helpers; 20 | 21 | public interface IViewModelWindowManager : IWindowManager 22 | { 23 | Task ShowDialogWithViewModel( 24 | Action? setViewModel = null, 25 | object? context = null) 26 | where TViewModel : PropertyChangedBase; 27 | 28 | Task ShowWindowWithViewModelAsync( 29 | Action? setViewModel = null, 30 | object? context = null) 31 | where TViewModel : PropertyChangedBase; 32 | 33 | Task ShowPopupWithViewModel( 34 | Action? setViewModel = null, 35 | object? context = null) 36 | where TViewModel : PropertyChangedBase; 37 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Resources/LogClientSink.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Log 4 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/CalburnSerilogBridge.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Helpers; 20 | 21 | public class CalburnSerilogBridge : ILog 22 | { 23 | readonly Lazy _logger; 24 | 25 | public CalburnSerilogBridge(Lazy logger) 26 | { 27 | this._logger = logger; 28 | } 29 | 30 | public void Info(string format, params object[] args) 31 | { 32 | if (!format.StartsWith("Action Convention Not Applied")) this._logger.Value.Verbose(format, args); 33 | } 34 | 35 | public void Warn(string format, params object[] args) 36 | { 37 | this._logger.Value.Warning(format, args); 38 | } 39 | 40 | public void Error(Exception exception) 41 | { 42 | this._logger.Value.Error(exception, "Exception Logged"); 43 | } 44 | } -------------------------------------------------------------------------------- /src/Papercut.Core/AppConstants.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core; 20 | 21 | public static class AppConstants 22 | { 23 | public const string ApplicationName = "Papercut SMTP"; 24 | 25 | public const string CompanyName = "Changemaker Studios"; 26 | 27 | public const string UpgradeUrl = "https://github.com/ChangemakerStudios/Papercut-SMTP"; 28 | 29 | public static string AppDataDirectory { get; } = 30 | Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), 31 | CompanyName, 32 | ApplicationName); 33 | 34 | public static string UserAppDataDirectory { get; } = 35 | Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), 36 | CompanyName, 37 | ApplicationName); 38 | } -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/Infrastructure/PapercutServiceTrayModule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac; 20 | using Papercut.Core.Domain.Paths; 21 | using Papercut.Core.Infrastructure.Container; 22 | using Papercut.Infrastructure.IPComm; 23 | 24 | namespace Papercut.Service.TrayNotification.Infrastructure; 25 | 26 | public class PapercutServiceTrayModule : Module 27 | { 28 | protected override void Load(ContainerBuilder builder) 29 | { 30 | foreach (var module in GetPapercutServiceModules()) 31 | { 32 | builder.RegisterModule(module); 33 | } 34 | 35 | builder.RegisterStaticMethods(ThisAssembly); 36 | } 37 | 38 | private IEnumerable GetPapercutServiceModules() 39 | { 40 | yield return new PapercutIPCommModule(); 41 | } 42 | } -------------------------------------------------------------------------------- /src/Papercut.Message/PapercutMessageModule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac; 20 | 21 | using Papercut.Core.Domain.Message; 22 | using Papercut.Core.Domain.Paths; 23 | 24 | namespace Papercut.Message; 25 | 26 | public class PapercutMessageModule : Module 27 | { 28 | protected override void Load(ContainerBuilder builder) 29 | { 30 | builder.Register(p => 31 | new MessageRepository(p.ResolveKeyed(PathTemplateType.Message), p.Resolve().ForContext())) 32 | .As().SingleInstance(); 33 | builder.RegisterType().As().SingleInstance(); 34 | builder.RegisterType().As().SingleInstance(); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Domain/UiCommands/IUiCommandHub.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Windows.Forms; 20 | 21 | using Papercut.Domain.UiCommands.Commands; 22 | 23 | namespace Papercut.Domain.UiCommands; 24 | 25 | public interface IUiCommandHub 26 | { 27 | IObservable OnShowBalloonTip { get; } 28 | 29 | IObservable OnShowOptionWindow { get; } 30 | 31 | IObservable OnShowMessage { get; } 32 | 33 | IObservable OnShowMainWindow { get; } 34 | 35 | void ShowMainWindow(bool selectMostRecentMessage = false); 36 | 37 | void ShowMessage(string messageText, string caption); 38 | 39 | void ShowOptionWindow(); 40 | 41 | void ShowBalloonTip(int timeout, string tipTitle, string tipText, ToolTipIcon toolTipIcon); 42 | } -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/AppLayer/TrayLoggingPathConfigurator.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Collections.ObjectModel; 20 | 21 | using Autofac; 22 | using Papercut.Core.Domain.Paths; 23 | 24 | namespace Papercut.Service.TrayNotification.AppLayer; 25 | 26 | public class TrayLoggingPathConfigurator : IPathTemplatesProvider 27 | { 28 | public ObservableCollection PathTemplates { get; } = new(["%DataDirectory%\\\\Logs"]); 29 | 30 | public PathTemplateType Type => PathTemplateType.Logging; 31 | 32 | #region Begin Static Container Registrations 33 | 34 | private static void Register(ContainerBuilder builder) 35 | { 36 | builder.RegisterType().Keyed(PathTemplateType.Logging).SingleInstance(); 37 | } 38 | 39 | #endregion 40 | } -------------------------------------------------------------------------------- /src/Papercut.Service.TrayNotification/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Papercut.UI/ViewModels/MimePartViewModel.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.ViewModels; 20 | 21 | public class MimePartViewModel : Screen 22 | { 23 | string _partText; 24 | 25 | string _windowTitle = "Mime Part Viewer"; 26 | 27 | public string WindowTitle 28 | { 29 | get => this._windowTitle; 30 | set 31 | { 32 | this._windowTitle = value; 33 | this.NotifyOfPropertyChange(() => this.WindowTitle); 34 | } 35 | } 36 | 37 | public string PartText 38 | { 39 | get => this._partText; 40 | set 41 | { 42 | this._partText = value; 43 | this.NotifyOfPropertyChange(() => this.PartText); 44 | } 45 | } 46 | 47 | public async Task Close() 48 | { 49 | await this.TryCloseAsync(false); 50 | } 51 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.Smtp/SmtpMessageStore.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Buffers; 20 | 21 | using Papercut.Core.Domain.Message; 22 | 23 | using SmtpServer; 24 | using SmtpServer.Mail; 25 | using SmtpServer.Protocol; 26 | using SmtpServer.Storage; 27 | 28 | namespace Papercut.Infrastructure.Smtp; 29 | 30 | public class SmtpMessageStore(IReceivedDataHandler receivedDataHandler) : MessageStore 31 | { 32 | public override async Task SaveAsync( 33 | ISessionContext context, 34 | IMessageTransaction transaction, 35 | ReadOnlySequence buffer, 36 | CancellationToken cancellationToken) 37 | { 38 | await receivedDataHandler.HandleReceivedAsync( 39 | buffer.ToArray(), 40 | transaction.To.Select(s => s.AsAddress()).ToArray()); 41 | 42 | return SmtpResponse.Ok; 43 | } 44 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Properties/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Papercut.Common/Extensions/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Papercut.Common.Helper; 20 | 21 | namespace Papercut.Common.Extensions; 22 | 23 | public static class EnumerableExtensions 24 | { 25 | public static IEnumerable IfNullEmpty(this IEnumerable? enumerable) 26 | { 27 | return enumerable ?? []; 28 | } 29 | 30 | public static IEnumerable WhereNotNull(this IEnumerable? enumerable) 31 | { 32 | return enumerable.IfNullEmpty().Where(s => s != null)!; 33 | } 34 | 35 | public static IEnumerable ToFormattedPairs(this IEnumerable>> keyValuePairs) 36 | { 37 | return keyValuePairs.IfNullEmpty().Select(s => KeyValuePair.Create(s.Key, $"{s.Value.Value}")) 38 | .Where(s => s.Value.IsSet()) 39 | .Select(s => $"{s.Key}: {s.Value}"); 40 | } 41 | } -------------------------------------------------------------------------------- /src/Papercut.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Runtime.InteropServices; 20 | 21 | // Setting ComVisible to false makes the types in this assembly not visible 22 | // to COM components. If you need to access a type in this assembly from 23 | // COM, set the ComVisible attribute to true on that type. 24 | [assembly: ComVisible(false)] 25 | 26 | // The following GUID is for the ID of the typelib if this project is exposed to COM 27 | [assembly: Guid("5fa0e4aa-27af-4801-b6ca-8c97dadd6da6")] 28 | 29 | // Version information for an assembly consists of the following four values: 30 | // 31 | // Major Version 32 | // Minor Version 33 | // Build Number 34 | // Revision 35 | // 36 | // You can specify all the values or you can default the Build and Revision Numbers 37 | // by using the '*' as shown below: 38 | // [assembly: AssemblyVersion("1.0.*")] 39 | -------------------------------------------------------------------------------- /src/Papercut.Rules/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Runtime.InteropServices; 20 | 21 | // Setting ComVisible to false makes the types in this assembly not visible 22 | // to COM components. If you need to access a type in this assembly from 23 | // COM, set the ComVisible attribute to true on that type. 24 | [assembly: ComVisible(false)] 25 | 26 | // The following GUID is for the ID of the typelib if this project is exposed to COM 27 | [assembly: Guid("5ec90c45-979d-43a5-ba1c-a286dbf4beca")] 28 | 29 | // Version information for an assembly consists of the following four values: 30 | // 31 | // Major Version 32 | // Minor Version 33 | // Build Number 34 | // Revision 35 | // 36 | // You can specify all the values or you can default the Build and Revision Numbers 37 | // by using the '*' as shown below: 38 | // [assembly: AssemblyVersion("1.0.*")] 39 | -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/EventHandlerHelpers.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reactive; 20 | 21 | namespace Papercut.Helpers; 22 | 23 | public static class EventHandlerHelpers 24 | { 25 | public static IObservable> ToObservable(this EventHandler eventHandler) 26 | { 27 | ArgumentNullException.ThrowIfNull(eventHandler); 28 | 29 | return Observable.FromEventPattern( 30 | a => eventHandler += a, 31 | d => eventHandler += d); 32 | } 33 | 34 | public static IObservable> ToObservable(this EventHandler eventHandler) 35 | where TArgs : EventArgs 36 | { 37 | ArgumentNullException.ThrowIfNull(eventHandler); 38 | 39 | return Observable.FromEventPattern, TArgs>( 40 | a => eventHandler += a, 41 | d => eventHandler += d); 42 | } 43 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/Container/AutofacRegistrationExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac.Builder; 20 | 21 | namespace Papercut.Core.Infrastructure.Container; 22 | 23 | public static class AutofacRegistrationExtensions 24 | { 25 | /// 26 | /// Single instance per UI scope 27 | /// 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | public static IRegistrationBuilder InstancePerUIScope(this IRegistrationBuilder builder) 34 | { 35 | return builder.InstancePerMatchingLifetimeScope(ContainerScope.UIScopeTag); 36 | } 37 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Domain/Settings/SettingsTypedExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.Core.Domain.Settings; 20 | 21 | public static class SettingsTypedExtensions 22 | { 23 | public static T UseTyped(this ISettingStore settingStore) 24 | where T : ISettingsTyped, new() 25 | { 26 | if (settingStore == null) throw new ArgumentNullException(nameof(settingStore)); 27 | 28 | return new T { Settings = settingStore }; 29 | } 30 | 31 | public static void Save(this ISettingsTyped typedSettings) 32 | { 33 | if (typedSettings == null) throw new ArgumentNullException(nameof(typedSettings)); 34 | 35 | typedSettings.Settings.Save(); 36 | } 37 | 38 | public static void Load(this ISettingsTyped typedSettings) 39 | { 40 | if (typedSettings == null) throw new ArgumentNullException(nameof(typedSettings)); 41 | 42 | typedSettings.Settings.Load(); 43 | } 44 | } -------------------------------------------------------------------------------- /src/Papercut.UI/Helpers/DisableEdgeFeaturesHelper.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Microsoft.Web.WebView2.Core; 20 | 21 | namespace Papercut.Helpers; 22 | 23 | public static class DisableEdgeFeaturesHelper 24 | { 25 | public static void DisableEdgeFeatures(this CoreWebView2 coreWeb) 26 | { 27 | ArgumentNullException.ThrowIfNull(coreWeb); 28 | 29 | // Note: AreDefaultContextMenusEnabled is kept TRUE to allow ContextMenuRequested event to fire 30 | // We customize the context menu via ContextMenuRequested handler instead 31 | // coreWeb.Settings.AreDefaultContextMenusEnabled = false; 32 | coreWeb.Settings.IsZoomControlEnabled = false; 33 | coreWeb.Settings.AreDevToolsEnabled = false; 34 | coreWeb.Settings.AreDefaultScriptDialogsEnabled = false; 35 | coreWeb.Settings.IsBuiltInErrorPageEnabled = false; 36 | 37 | // Issue #145 fixed 38 | coreWeb.Settings.IsStatusBarEnabled = true; 39 | } 40 | } -------------------------------------------------------------------------------- /src/Papercut.Core/Papercut.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 8.3.0 14 | 15 | 16 | 17 | 5.0.0 18 | 19 | 20 | 13.0.3 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Logging/SeqLogging.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Serilog.Configuration; 20 | 21 | namespace Papercut.AppLayer.Logging; 22 | 23 | public class SeqLogging : ILoggerSettings 24 | { 25 | public void Configure(LoggerConfiguration loggerConfiguration) 26 | { 27 | ArgumentNullException.ThrowIfNull(loggerConfiguration, nameof(loggerConfiguration)); 28 | 29 | loggerConfiguration.WriteTo.Seq("http://localhost:5341"); 30 | } 31 | 32 | #region Begin Static Container Registrations 33 | 34 | /// 35 | /// Called dynamically from the RegisterStaticMethods() call in the container module. 36 | /// 37 | /// 38 | [UsedImplicitly] 39 | static void Register(ContainerBuilder builder) 40 | { 41 | ArgumentNullException.ThrowIfNull(builder, nameof(builder)); 42 | 43 | builder.RegisterType().As(); 44 | } 45 | 46 | #endregion 47 | } -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/PapercutIPCommModule.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Autofac; 20 | 21 | using Papercut.Infrastructure.IPComm.Network; 22 | 23 | namespace Papercut.Infrastructure.IPComm; 24 | 25 | using Module = Autofac.Module; 26 | 27 | public class PapercutIPCommModule : Module 28 | { 29 | protected override void Load(ContainerBuilder builder) 30 | { 31 | builder.RegisterType().AsSelf().InstancePerDependency(); 32 | builder.RegisterType().AsSelf().InstancePerDependency(); 33 | builder.RegisterType().AsSelf().InstancePerDependency(); 34 | builder.RegisterType().AsSelf().SingleInstance(); 35 | builder.RegisterType().AsSelf().SingleInstance(); 36 | builder.RegisterType().AsSelf().InstancePerDependency(); 37 | builder.RegisterType().AsSelf().SingleInstance(); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Diagnostics/ReportVersionService.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | namespace Papercut.AppLayer.Diagnostics; 20 | 21 | public class ReportVersionService(ILogger logger) : IStartable 22 | { 23 | public void Start() 24 | { 25 | var productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion; 26 | 27 | logger.Information("Papercut Version {PapercutVersion:l}", productVersion); 28 | } 29 | 30 | #region Begin Static Container Registrations 31 | 32 | /// 33 | /// Called dynamically from the RegisterStaticMethods() call in the container module. 34 | /// 35 | /// 36 | [UsedImplicitly] 37 | static void Register(ContainerBuilder builder) 38 | { 39 | ArgumentNullException.ThrowIfNull(builder); 40 | 41 | builder.RegisterType().AsImplementedInterfaces().SingleInstance(); 42 | } 43 | 44 | #endregion 45 | } -------------------------------------------------------------------------------- /installation/winget/ChangemakerStudios.PapercutSMTP.locale.en-US.yaml: -------------------------------------------------------------------------------- 1 | PackageIdentifier: "ChangemakerStudios.PapercutSMTP" 2 | PackageVersion: "7.6.0" 3 | PackageLocale: "en-US" 4 | Publisher: "Changemaker Studios" 5 | PublisherUrl: "https://github.com/ChangemakerStudios" 6 | PublisherSupportUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/issues" 7 | Author: "Ken Robertson & Jaben Cargman" 8 | PackageName: "Papercut SMTP" 9 | PackageUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP" 10 | License: "Apache-2.0" 11 | LicenseUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/blob/develop/LICENSE" 12 | Copyright: "Copyright © 2008 - 2025 Ken Robertson & Jaben Cargman" 13 | ShortDescription: "Standalone SMTP server designed for viewing received messages" 14 | Description: | 15 | Papercut SMTP is a 2-in-1 quick email viewer AND built-in SMTP server designed for development. 16 | It allows developers to safely test email functionality without risk of emails being sent to real recipients. 17 | 18 | Features: 19 | - Desktop WPF application for viewing emails 20 | - Built-in SMTP server (receive-only) 21 | - Full email inspection (body, HTML, headers, attachments, raw encoded bits) 22 | - Support for running as a minimized tray application with notifications 23 | - WebView2-based HTML email rendering 24 | Moniker: "papercut" 25 | Tags: 26 | - "smtp" 27 | - "email" 28 | - "development" 29 | - "testing" 30 | - "developer-tools" 31 | - "mail-server" 32 | ReleaseNotes: "https://github.com/ChangemakerStudios/Papercut-SMTP/releases/tag/7.6.0" 33 | ReleaseNotesUrl: "https://github.com/ChangemakerStudios/Papercut-SMTP/releases/tag/7.6.0" 34 | ManifestType: "defaultLocale" 35 | ManifestVersion: "1.6.0" 36 | -------------------------------------------------------------------------------- /src/Papercut.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Runtime.CompilerServices; 20 | using System.Runtime.InteropServices; 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM components. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | 26 | [assembly: ComVisible(false)] 27 | 28 | // The following GUID is for the ID of the typelib if this project is exposed to COM 29 | 30 | [assembly: Guid("07329774-984a-4388-833e-21b16bdf5095")] 31 | 32 | // Version information for an assembly consists of the following four values: 33 | // 34 | // Major Version 35 | // Minor Version 36 | // Build Number 37 | // Revision 38 | // 39 | // You can specify all the values or you can default the Build and Revision Numbers 40 | // by using the '*' as shown below: 41 | // [assembly: AssemblyVersion("1.0.*")] 42 | 43 | [assembly:InternalsVisibleTo("Papercut.App.WebApi.Test")] 44 | -------------------------------------------------------------------------------- /src/Papercut.Core/Infrastructure/MessageBus/PublishEventExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Reflection; 20 | 21 | using Papercut.Common.Domain; 22 | 23 | namespace Papercut.Core.Infrastructure.MessageBus; 24 | 25 | [PublicAPI] 26 | public static class PublishEventExtensions 27 | { 28 | static readonly MethodInfo? _publishAsyncMethodInfo = typeof(IMessageBus).GetMethod(nameof(IMessageBus.PublishAsync)); 29 | 30 | public static Task PublishObjectAsync( 31 | this IMessageBus messageBus, 32 | object @event, 33 | Type eventType, 34 | CancellationToken token = default) 35 | { 36 | if (messageBus == null) throw new ArgumentNullException(nameof(messageBus)); 37 | if (_publishAsyncMethodInfo == null) throw new InvalidOperationException("PublishAsync method not found"); 38 | 39 | MethodInfo publishMethod = _publishAsyncMethodInfo.MakeGenericMethod(eventType); 40 | 41 | return (Task)publishMethod.Invoke(messageBus, [@event, token])!; 42 | } 43 | } -------------------------------------------------------------------------------- /examples/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net9.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | PreserveNewest 35 | 36 | 37 | PreserveNewest 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Behaviors/InteractivityBlurBase.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Windows.Media.Effects; 20 | 21 | using Microsoft.Xaml.Behaviors; 22 | 23 | namespace Papercut.AppLayer.Behaviors; 24 | 25 | public class InteractivityBlurBase : Behavior 26 | where T : DependencyObject 27 | { 28 | // Using a DependencyProperty as the backing store for BlurRadius. This enables animation, styling, binding, etc... 29 | public static readonly DependencyProperty BlurRadiusProperty = 30 | DependencyProperty.Register( 31 | $"BlurRadius_{typeof(T).Name}", 32 | typeof(int), 33 | typeof(FrameworkElement), 34 | new UIPropertyMetadata(0)); 35 | 36 | public int BlurRadius 37 | { 38 | get => (int) this.GetValue(BlurRadiusProperty); 39 | set => this.SetValue(BlurRadiusProperty, value); 40 | } 41 | 42 | protected virtual BlurEffect GetBlurEffect() 43 | { 44 | return new BlurEffect { Radius = this.BlurRadius }; 45 | } 46 | } -------------------------------------------------------------------------------- /src/Papercut.UI/AppLayer/Themes/SystemThemeRegistryHelper.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Microsoft.Win32; 20 | 21 | namespace Papercut.AppLayer.Themes; 22 | 23 | public static class SystemThemeRegistryHelper 24 | { 25 | private const string RegistryKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; 26 | 27 | private const string RegistryValueName = "AppsUseLightTheme"; 28 | 29 | internal static bool IsSystemDarkMode() 30 | { 31 | try 32 | { 33 | using var key = Registry.CurrentUser.OpenSubKey(RegistryKeyPath); 34 | var value = key?.GetValue(RegistryValueName); 35 | 36 | if (value is int intValue) 37 | { 38 | return intValue == 0; // 1 = Light theme, 0 = Dark theme 39 | } 40 | } 41 | catch (Exception ex) 42 | { 43 | Log.Warning(ex, "Failed to read current system theme from registry"); 44 | } 45 | 46 | // Default to light theme on error 47 | return false; 48 | } 49 | } -------------------------------------------------------------------------------- /src/Papercut.Service/Web/Hosting/InProcess/RequestFeature.cs: -------------------------------------------------------------------------------- 1 | //// Papercut 2 | //// 3 | //// Copyright © 2008 - 2012 Ken Robertson 4 | //// Copyright © 2013 - 2025 Jaben Cargman 5 | //// 6 | //// Licensed under the Apache License, Version 2.0 (the "License"); 7 | //// you may not use this file except in compliance with the License. 8 | //// You may obtain a copy of the License at 9 | //// 10 | //// http://www.apache.org/licenses/LICENSE-2.0 11 | //// 12 | //// Unless required by applicable law or agreed to in writing, software 13 | //// distributed under the License is distributed on an "AS IS" BASIS, 14 | //// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | //// See the License for the specific language governing permissions and 16 | //// limitations under the License. 17 | 18 | 19 | //namespace Papercut.Service.Web.Hosting.InProcess; 20 | 21 | //internal class RequestFeature : IHttpRequestFeature 22 | //{ 23 | // public RequestFeature() 24 | // { 25 | // Body = Stream.Null; 26 | // Headers = new HeaderDictionary(); 27 | // Method = "GET"; 28 | // Path = ""; 29 | // PathBase = ""; 30 | // Protocol = "HTTP/1.1"; 31 | // QueryString = ""; 32 | // Scheme = "http"; 33 | // } 34 | 35 | // public Stream Body { get; set; } 36 | 37 | // public IHeaderDictionary Headers { get; set; } 38 | 39 | // public string Method { get; set; } 40 | 41 | // public string Path { get; set; } 42 | 43 | // public string PathBase { get; set; } 44 | 45 | // public string Protocol { get; set; } 46 | 47 | // public string QueryString { get; set; } 48 | 49 | // public string Scheme { get; set; } 50 | 51 | // public string RawTarget { get; set; } 52 | //} -------------------------------------------------------------------------------- /src/Papercut.UI/ViewModels/RuleTypeSelectionViewModel.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Collections.ObjectModel; 20 | 21 | using Papercut.Core.Domain.Rules; 22 | 23 | namespace Papercut.ViewModels; 24 | 25 | public class RuleTypeSelectionViewModel(IEnumerable availableRuleTypes) : Screen 26 | { 27 | private IRule? _selectedRuleType; 28 | 29 | public ObservableCollection AvailableRuleTypes { get; } = new(availableRuleTypes); 30 | 31 | public IRule? SelectedRuleType 32 | { 33 | get => _selectedRuleType; 34 | set 35 | { 36 | _selectedRuleType = value; 37 | NotifyOfPropertyChange(() => SelectedRuleType); 38 | NotifyOfPropertyChange(() => CanAdd); 39 | } 40 | } 41 | 42 | public bool CanAdd => SelectedRuleType != null; 43 | 44 | public void Add() 45 | { 46 | if (SelectedRuleType != null) 47 | { 48 | TryCloseAsync(true); 49 | } 50 | } 51 | 52 | public void Cancel() 53 | { 54 | TryCloseAsync(false); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.IPComm/Papercut - Backup.Infrastructure.IPComm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | true 7 | AnyCPU 8 | 9 | 10 | 11 | false 12 | false 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Properties\GlobalAssemblyInfo.cs 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 6.2.0 38 | 39 | 40 | 13.0.1 41 | 42 | 43 | 2.10.0 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/Papercut.Infrastructure.Smtp/SessionContextExtensions.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using System.Net; 20 | 21 | using SmtpServer; 22 | 23 | namespace Papercut.Infrastructure.Smtp; 24 | 25 | /// 26 | /// Extension methods for ISessionContext to extract connection information. 27 | /// 28 | public static class SessionContextExtensions 29 | { 30 | /// 31 | /// Gets the remote IP address from the session context. 32 | /// 33 | /// The SMTP session context 34 | /// The remote IP address, or IPAddress.None if it cannot be determined 35 | public static IPAddress GetRemoteIpAddress(this ISessionContext context) 36 | { 37 | ArgumentNullException.ThrowIfNull(context, nameof(context)); 38 | 39 | // RemoteEndPoint is stored in the Properties dictionary by SmtpServer 40 | return context.Properties.TryGetValue("EndpointListener:RemoteEndPoint", out var endpoint) 41 | && endpoint is IPEndPoint remoteEndPoint 42 | ? remoteEndPoint.Address 43 | : IPAddress.None; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Papercut.UI/Infrastructure/VelopackBridgeLogger.cs: -------------------------------------------------------------------------------- 1 | // Papercut 2 | // 3 | // Copyright © 2008 - 2012 Ken Robertson 4 | // Copyright © 2013 - 2025 Jaben Cargman 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | 19 | using Serilog.Events; 20 | 21 | using Velopack; 22 | using Velopack.Logging; 23 | 24 | namespace Papercut.Infrastructure; 25 | 26 | public class VelopackBridgeLogger(ILogger logger) : IVelopackLogger 27 | { 28 | public void Log(VelopackLogLevel logLevel, string? message, Exception? exception) 29 | { 30 | logger.ForContext().Write(ToLogEventLevel(logLevel), exception, message ?? "[Empty]"); 31 | } 32 | 33 | public static LogEventLevel ToLogEventLevel(VelopackLogLevel velopackLevel) 34 | { 35 | return velopackLevel switch 36 | { 37 | VelopackLogLevel.Trace => LogEventLevel.Verbose, 38 | VelopackLogLevel.Debug => LogEventLevel.Debug, 39 | VelopackLogLevel.Information => LogEventLevel.Information, 40 | VelopackLogLevel.Warning => LogEventLevel.Warning, 41 | VelopackLogLevel.Error => LogEventLevel.Error, 42 | VelopackLogLevel.Critical => LogEventLevel.Fatal, 43 | _ => LogEventLevel.Information // fallback 44 | }; 45 | } 46 | } --------------------------------------------------------------------------------