{"id":31711016,"url":"https://github.com/railsware/mailtrap-dotnet","last_synced_at":"2025-10-09T00:52:58.844Z","repository":{"id":309487555,"uuid":"807107365","full_name":"railsware/mailtrap-dotnet","owner":"railsware","description":"Official mailtrap.io .NET client","archived":false,"fork":false,"pushed_at":"2025-10-08T07:54:18.000Z","size":749,"stargazers_count":0,"open_issues_count":14,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-10-08T09:28:08.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mailtrap.io","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railsware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-28T13:50:06.000Z","updated_at":"2025-10-08T07:54:20.000Z","dependencies_parsed_at":"2025-09-08T13:08:41.804Z","dependency_job_id":"8f6901c9-d0ed-436b-b44f-2554c16081b9","html_url":"https://github.com/railsware/mailtrap-dotnet","commit_stats":null,"previous_names":["railsware/mailtrap-dotnet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/railsware/mailtrap-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fmailtrap-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fmailtrap-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fmailtrap-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fmailtrap-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/mailtrap-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fmailtrap-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000641,"owners_count":26082879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-09T00:52:54.910Z","updated_at":"2025-10-09T00:52:58.838Z","avatar_url":"https://github.com/railsware.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Mailtrap](assets/img/mailtrap-logo.svg)\n\n[![GitHub Package Version](https://img.shields.io/github/v/release/railsware/mailtrap-dotnet?label=GitHub%20Packages)](https://github.com/orgs/railsware/packages/nuget/package/Mailtrap)\n[![CI](https://github.com/railsware/mailtrap-dotnet/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/railsware/mailtrap-dotnet/actions/workflows/build.yml)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/railsware/mailtrap-dotnet/blob/main/LICENSE.md)\n\n# Official Mailtrap .NET Client\nWelcome to the official [Mailtrap](https://mailtrap.io/) .NET Client repository.  \nThis client allows you to quickly and easily integrate your .NET application with **v2.0** of the [Mailtrap API](https://api-docs.mailtrap.io/docs/mailtrap-api-docs/5tjdeg9545058-mailtrap-api).\n\n\n## Prerequisites\n\nTo get the most out of this official Mailtrap.io .NET SDK:\n- [Create a Mailtrap account](https://mailtrap.io/signup)\n- [Verify your domain](https://mailtrap.io/sending/domains)\n- Obtain [API token](https://mailtrap.io/api-tokens)\n- Please ensure your project targets .NET implementation which supports [.NET Standard 2.0](https://dotnet.microsoft.com/platform/dotnet-standard#versions) specification.\n\n## Supported functionality\n\nThe Mailtrap .NET client provides comprehensive access to the Mailtrap API v2.0, including:\n\n### Email API/SMTP\n- Send an email (Transactional and Bulk streams)\n- Send an email with a template\n- Send emails with attachments\n\n### Email Sandbox (Testing)\n- Send an email\n- Send an email with a template\n- Message management\n- List inboxes\n- Get inbox details\n- Update inbox settings\n- Create, read, update, and delete projects\n- Project configuration and settings\n\n### General\n- Account access management\n- Permissions management\n- List accounts you have access to\n- Billing information and usage statistics\n- Domain verification\n\n## Quick Start\nThe following few simple steps will bring Mailtrap API functionality into your .NET project.\n\n### Install\nThe Mailtrap .NET client packages are available through GitHub Packages.\n\nFirst, add the GitHub Packages source to your NuGet configuration:\n\n```console\ndotnet nuget add source https://nuget.pkg.github.com/railsware/index.json --name github-railsware\n```\n\nThen add Mailtrap package:\n\n```console\ndotnet add package Mailtrap -v 2.0.0 -s github-railsware\n```\n\nOptionally, you can add Mailtrap.Abstractions package:\n\n```console\ndotnet add package Mailtrap.Abstractions -v 2.0.0 -s github-railsware\n```\n\n### Configure\nAdd Mailtrap services to the DI container.\n\n```csharp\nusing Mailtrap;\n   \n...\n   \nhostBuilder.ConfigureServices((context, services) =\u003e\n{\n   services.AddMailtrapClient(options =\u003e\n   {\n      // Definitely, hardcoding a token isn't a good idea.\n      // This example uses it for simplicity, but in real-world scenarios\n      // you should consider more secure approaches for storing secrets.\n         \n      // Environment variables can be an option, as well as other solutions:\n      // https://learn.microsoft.com/aspnet/core/security/app-secrets\n      // or https://learn.microsoft.com/aspnet/core/security/key-vault-configuration\n      options.ApiToken = \"\u003cAPI_TOKEN\u003e\";\n   });\n});   \n```\n\n### Use\nNow you can inject `IMailtrapClient` instance in any application service and use it to make API calls.\n\n```csharp\nusing Mailtrap;\nusing Mailtrap.Emails.Requests;\nusing Mailtrap.Emails.Responses;\n   \n\nnamespace MyAwesomeProject;\n\n\npublic sealed class SendEmailService : ISendEmailService\n{\n    private readonly IMailtrapClient _mailtrapClient;\n\n\n    public SendEmailService(IMailtrapClient mailtrapClient)\n    {\n        _mailtrapClient = mailtrapClient;\n    }\n\n\n    public async Task DoWork()\n    {\n        try \n        {\n            SendEmailRequest request = SendEmailRequest\n                .Create()\n                .From(\"john.doe@demomailtrap.com\", \"John Doe\")\n                .To(\"hero.bill@galaxy.net\")\n                .Subject(\"Invitation to Earth\")\n                .Text(\"Dear Bill,\\n\\nIt will be a great pleasure to see you on our blue planet next weekend.\\n\\nBest regards, John.\");\n\n            SendEmailResponse response = await _mailtrapClient\n                .Email()\n                .Send(request);\n                \n            string messageId = response.MessageIds.FirstOrDefault();\n        }\n        catch (MailtrapException mtex)\n        {\n            // handle Mailtrap API specific exceptions\n        }\n        catch (OperationCancelledException ocex)\n        {\n            // handle cancellation\n        }\n        catch (Exception ex)\n        {\n            // handle other exceptions\n        }   \n    }\n}\n```\n\n## Examples\n\nThe repository includes comprehensive examples demonstrating various use cases and features:\n\n### Email API/SMTP\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send an email (Transactional and Bulk streams)\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send an email with a template\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send a batch of emails (Transactional and Bulk streams)\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send emails with attachments\n\n### Email Sandbox (Testing)\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send an email\n- **[Email Sending](examples/Mailtrap.Example.Email.Send/)** - Send an email with a template\n- **[Testing Messages](examples/Mailtrap.Example.TestingMessage/)** - Message management\n- **[Attachments](examples/Mailtrap.Example.Attachment/)** - Working with email attachments in testing messages\n- **[Inbox Management](examples/Mailtrap.Example.Inbox/)** - Inbox management\n- **[Project Management](examples/Mailtrap.Example.Project/)** - Project management\n\n### General\n- **[Account Access](examples/Mailtrap.Example.AccountAccess/)** - Account access management\n- **[Permissions](examples/Mailtrap.Example.Permissions/)** - Permissions management\n- **[Account Management](examples/Mailtrap.Example.Account/)** - List accounts you have access to\n- **[Billing](examples/Mailtrap.Example.Billing/)** - Billing information and usage statistics\n- **[Sending Domains](examples/Mailtrap.Example.SendingDomain/)** - Domain verification\n- **[Comprehensive API Usage](examples/Mailtrap.Example.ApiUsage/)** - Complete example showcasing multiple API features together\n\n### Configuration \u0026 Setup\n- **[Dependency Injection](examples/Mailtrap.Example.DependencyInjection/)** - Integration with ASP.NET Core DI container and configuration\n- **[Factory Pattern](examples/Mailtrap.Example.Factory/)** - Using standalone client factory for scenarios without DI container\n\nEach example includes detailed comments and demonstrates best practices for error handling, configuration, and resource management.\n\n## Documentation\nPlease visit [Documentation Portal](https://railsware.github.io/mailtrap-dotnet/) for detailed setup, configuration and usage instructions.\n\n\n## Contributing\nWe believe in the power of OSS and welcome any contributions to the library.  \nPlease refer to [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\nLicensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fmailtrap-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fmailtrap-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fmailtrap-dotnet/lists"}