{"id":24127038,"url":"https://gitlab.com/tem_leonov/FluentMailer","last_synced_at":"2025-09-18T18:32:40.073Z","repository":{"id":64641568,"uuid":"915503","full_name":"tem_leonov/FluentMailer","owner":"tem_leonov","description":"Module for sending emails via smtp with fluent interface","archived":false,"fork":false,"pushed_at":null,"size":null,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":null,"default_branch":"master","last_synced_at":"2025-01-08T08:53:49.440Z","etag":null,"topics":[".NET","email sender","fluent interface","smtp"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":null,"metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-27T14:17:38.276Z","updated_at":"2016-12-11T16:20:23.485Z","dependencies_parsed_at":"2022-12-12T10:09:00.135Z","dependency_job_id":null,"html_url":"https://gitlab.com/tem_leonov/FluentMailer","commit_stats":null,"previous_names":["artem-leonov/fluentmailer"],"tags_count":12,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/tem_leonov%2FFluentMailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/tem_leonov%2FFluentMailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/tem_leonov%2FFluentMailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/tem_leonov%2FFluentMailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/tem_leonov","download_url":"https://gitlab.com/tem_leonov/FluentMailer/-/archive/master/FluentMailer-master.zip","host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","repositories_count":4516772,"owners_count":6642,"icon_url":"https://github.com/gitlab.png","version":null,"created_at":"2022-05-30T11:31:42.605Z","updated_at":"2024-07-18T11:24:13.055Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners"}},"keywords":[".NET","email sender","fluent interface","smtp"],"created_at":"2025-01-11T17:26:24.989Z","updated_at":"2025-09-18T18:32:34.584Z","avatar_url":null,"language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project moved to Github\nhttps://github.com/artem-leonov/FluentMailer\n\n# Fluent Mailer\nModule for sending emails via smtp with fluent interface\n\n# Configuration\n\n## Add into Web.config/app.config standart system.net/mailSettings configuration. For example:\n```xml\n\u003csystem.net\u003e\n\t\u003cmailSettings\u003e\n\t\t\u003csmtp from=\"qwerty@qwerty.com\"\u003e\n\t\t\t\u003cnetwork enableSsl=\"true\" host=\"smtp.qwerty.com\" port=\"587\" userName=\"qwerty@qwerty.com\" password=\"qwertyqwerty\" /\u003e\n\t\t\u003c/smtp\u003e\n\t\u003c/mailSettings\u003e\n\u003c/system.net\u003e\n```\n\n## Prepare Fluent Mailer Resolving\nFor now you have two ways to resolve Fluent Mailer Instance:\n1. Register Fluent Mailer dependencies in Unity (using FluentMailer.Unity package)\n```csharp\nvar unityContainer = new UnityContainer();\nunityContainer.RegisterFluentMailerDependencies();\n```\nNow, you can resolve Fluent Mailer through Unity:\n```csharp\npublic class SomeService\n{\n\tprivate readonly IFluentMailer _fluentMailer;\n\t\n\tpublic SomeService(IFluentMailer fluentMailer)\n\t{\n\t\t_fluentMailer = fluentMailer;\n\t}\n\t\n\tpublic void SendMessage()\n\t{\n\t\t// Using _fluentMailer here\n\t}\n}\n```\n2. Resolve Fluent Mailer through a static factory (using FluentMailer.Factory package)\n```csharp\nvar fluentMailer = FluentMailerFactory.Create();\n```\nAdditionally, you can configure resolving Fluent Mailer through a static factory for you dependency injection container.\nExample for NInject:\n```csharp\nBind\u003cIFluentMailer\u003e.ToMethod(context =\u003e FluentMailerFactory.Create())\n```\n\n# Using Fluent Mailer\n\n## 1. Create Message\n```csharp\nvar message = _fluentMailer.CreateMessage();\n```\n\n## 2. Configure Message Body\n\n### With view\n\n```csharp\nvar mailSender = message.WithView(\"~/Views/Mailer/Mail.cshtml\");\n```\n\n### With view and model\n```csharp\nvar model = new MailModel();\nvar mailSender = message.WithView(\"~/Views/Mailer/Mail.cshtml\", model);\n```\n\n### With view body\n```csharp\nvar mailSender = message.WithViewBody(\"\u003chtml\u003e\u003cbody\u003eTest message\u003c/body\u003e\u003c/html\u003e\");\n```\n    \n## 3. Configure Other Message Properties\n\n### Adding receivers\n```csharp\nmailSender.WithReceiver(\"abc@abc.com\"); // Adds abc@abc.com to recievers\nmailSender.WithReceivers(new [] {\"bcd@bcd.com\", \"cde@cde.com\"}); // Adds bcd@bcd.com and cde@cde.com to receivers too\n```\n\n### Setting Up Subject\n```csharp\nmailSender.WithSubject(\"Mail subject\");\n```\n\n### Adding attachments\n```csharp\nvar fstream = new FileStream(AppDomain.CurrentDomain.BaseDirectory + \"/1.docx\", FileMode.Open);\nmailSender.WithAttachment(fstream, \"document.docx\")\n\t.WithAttachment(\"~/book.pdf\");\n```\n\n## 4. Send Mail\n\n### Synchronously\n```csharp\nmailSender.Send();\n```\n\n### Asynchronously\n```csharp\nawait mailSender.SendAsync();\n```\n    \n# Fluent Interface\n\nYou can do all of it in one move\n```csharp\nawait _fluentMailer.CreateMessage()\n\t.WithViewBody(\"\u003chtml\u003e\u003cbody\u003eTest message\u003c/body\u003e\u003c/html\u003e\")\n\t.WithReceiver(\"abc@abc.com\")\n\t.WithReceiver(\"bcd@bcd.com\")\n\t.WithSubject(\"Mail subject\")\n\t.SendAsync();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Ftem_leonov%2FFluentMailer","html_url":"https://awesome.ecosyste.ms/projects/gitlab.com%2Ftem_leonov%2FFluentMailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Ftem_leonov%2FFluentMailer/lists"}