{"id":37039975,"url":"https://github.com/promact/emailservice","last_synced_at":"2026-01-14T04:44:23.493Z","repository":{"id":81645747,"uuid":"300919516","full_name":"Promact/EmailService","owner":"Promact","description":"Generic Email service implementation for sending emails via different Email providers (SES, SendGrid etc.)","archived":false,"fork":false,"pushed_at":"2024-02-16T09:33:52.000Z","size":598,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-26T12:54:34.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Promact.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-10-03T15:59:39.000Z","updated_at":"2024-02-15T08:30:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae901689-a130-4736-bcf1-ec4adc041191","html_url":"https://github.com/Promact/EmailService","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Promact/EmailService","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Promact%2FEmailService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Promact%2FEmailService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Promact%2FEmailService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Promact%2FEmailService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Promact","download_url":"https://codeload.github.com/Promact/EmailService/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Promact%2FEmailService/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":"2026-01-14T04:44:22.838Z","updated_at":"2026-01-14T04:44:23.487Z","avatar_url":"https://github.com/Promact.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EmailService\nGeneric Email service implementation for sending emails via different Email providers (SES, SendGrid,SMTP,Azure etc.)\n\n# Usage\n\n```\nprivate IEmailService _emailService;\n\npublic async Task MyMethod()\n{\n    // The email which we are using should be verified in Service Provider whichever you are using (SES, SendGrid,SMTP etc.)\n    //In Case Of Azure Your EmailDomain Should be Verified And Connected To Your  Email Communications Services\n\n    var email = new Email(\n        to: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn@domain.com\", \"Receiver Name\")\n        },\n        from: new EmailAddress(\"abc@pqr.com\", \"Sender Name\"),\n        cc: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz1@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn1@domain.com\", \"Receiver Name\")\n        },\n        bcc: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz2@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn2@domain.com\", \"Receiver Name\")\n        },\n        subject: \"Test subject\",\n        body: \"Test body\",\n        isBodyHtml: true\n    );\n\n    // Add attachments. You can Attach Multiple Attachment\n    email.Attachments.Add(new AttachmentData(\n        content: System.IO.File.ReadAllBytes(\"path/to/file.txt\"),\n        fileName: \"FileName\",\n        contentType: \"FileType\"\n    ));\n\n    await _emailService.SendEmailAsync(email);\n}\n\npublic async Task SendTemplatedEmail()\n{\n    var templatedEmailRequest = new TemplatedEmailRequest(\n        to: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn@domain.com\", \"Receiver Name\")\n        },\n        from: new EmailAddress(\"abc@pqr.com\", \"Sender Name\"),\n        cc: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz1@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn1@domain.com\", \"Receiver Name\")\n        },\n        bcc: new List\u003cEmailAddress\u003e\n        {\n            new EmailAddress(\"xyz2@domain.com\", \"Receiver Name\"),\n            new EmailAddress(\"lmn2@domain.com\", \"Receiver Name\")\n        },\n        templateNameOrId: \"TemplateID\", // Replace with your actual template name or ID\n        templateData: new { name = \"Value1\" }, // Replace with your actual template data            \n        subject: \"Subject\"\n    );\n\n    // Add attachments\n    templatedEmailRequest.Attachments.Add(new AttachmentData(\n        content: System.IO.File.ReadAllBytes(\"path/to/file.txt\"),\n        fileName: \"FileName\",\n        contentType: \"FileType\"\n    ));\n\n    await _emailService.SendTemplatedEmailAsync(templatedEmailRequest);\n}\n\n```\n\n# SES\n\nAdd nuget package\n\n```\nPromact.EmailService.SES\n```\n\n## ASP.NET Core projects\n\nAdd below in `Startup.cs` inside `ConfigureServices` method\n\n```\nservices.AddSESEmailService(options =\u003e\n{\n    options.AccessKeyId = Configuration.GetSection(\"AWS:AccessKeyId\").Value;\n    options.SecretAccessKey = Configuration.GetSection(\"AWS:SecretAccessKey\").Value;\n    options.Region = Configuration.GetSection(\"AWS:Region\").Value;\n});\n```\n\nAdd relevant appsettings.json values\n\n```\n\"AWS\": {\n    \"AccessKeyID\": \"\",\n    \"SecretAccessKey\": \"\",\n    \"Region\":  \"\"\n}\n```\n\nInject `IEmailService` in class constructor from where you want to send emails\n\n```\npublic MyClass(IEmailService emailService)\n{\n...\n}\n```\n\n## Console or other type of applications\n\nCreate new object of SESEmailService passing relevant configuration values\n\n```\nvar emailService = new SESEmailService(new SESOptions(){ });\n```\n\n# SendGrid\n\nAdd nuget package\n\n```\nPromact.EmailService.SendGrid\n```\n\n## ASP.NET Core projects\n\nAdd below in `Startup.cs` inside `ConfigureServices` method\n\n```\nservices.AddSendGridEmailService(options =\u003e\n{\n    options.APIKey = Configuration.GetSection(\"SendGrid:APIKey\").Value;\n});\n```\n\nAdd relevant appsettings.json values\n\n```\n\"SendGrid\": {\n    \"APIKey\": \"\"\n}\n```\n\nInject `IEmailService` in class constructor from where you want to send emails\n\n```\npublic MyClass(IEmailService emailService)\n{\n...\n}\n```\n\n## Console or other type of applications\n\nCreate new object of SendGridEmailService passing relevant configuration values\n\n```\nvar emailService = new SendGridEmailService(new SendGridOptions(){ });\n```\n\n# SMTP\n\nAdd nuget package\n\n```\nPromact.EmailService.SMTP\n```\n\n## ASP.NET Core projects\n\nAdd below in `Startup.cs` inside `ConfigureServices` method\n\n```\n services.AddSMTPEmailService(options =\u003e\n {\n     options.Host = configuration.GetSection(\"SMTP:Host\").Value;\n     options.Port = int.Parse(configuration.GetSection(\"SMTP:Port\").Value);\n     options.UserName = configuration.GetSection(\"SMTP:UserName\").Value;\n     options.Password = configuration.GetSection(\"SMTP:Password\").Value;\n });\n```\n\nAdd relevant appsettings.json values\n\n```\n\"SMTP\": {\n  \"Host\": \"\",\n  \"Port\":,\n  \"UserName\": \"\",\n  \"Password\": \"\"\n}\n```\n\nInject `IEmailService` in class constructor from where you want to send emails\n\n```\npublic MyClass(IEmailService emailService)\n{\n...\n}\n```\n\n## Console or other type of applications\n\nCreate new object of SMTPEmailService passing relevant configuration values\n\n```\nvar emailService = new SMTPEmailService(new SMTPOptions(){ });\n```\n\n# Azure\n\nAdd nuget package\n\n```\nPromact.EmailService.Azure\n```\n\n## ASP.NET Core projects\n\nAdd below in `Startup.cs` inside `ConfigureServices` method\n\n```\nservices.AddAzureEmailService(options =\u003e\n{\n    options.ConnectionString= Configuration.GetSection(\"Azure:ConnectionString\").Value;\n});\n```\n\nAdd relevant appsettings.json values\n\n```\n// You can get your connection string From Azure Portal in  Your Communication Service \u003e Setting \u003e Keys.\n\"Azure\": {\n  \"ConnectionString\": \"\"\n},\n```\n\nInject `IEmailService` in class constructor from where you want to send emails\n\n```\npublic MyClass(IEmailService emailService)\n{\n...\n}\n```\n\n## Console or other type of applications\n\nCreate new object of AzureEmailService passing relevant configuration values\n\n```\nvar emailService = new AzureEmailService(new AzureOptions(){ });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromact%2Femailservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpromact%2Femailservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromact%2Femailservice/lists"}