.NET 도움말 FluentEmail C# (How It Works For Developers) 커티스 차우 업데이트됨:7월 28, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 In today's digital age, email remains a cornerstone of communication for businesses and individuals. Integrating robust email functionality into ASP.NET Core applications is essential for automating notifications, sending newsletters, and facilitating customer interactions. FluentEmail, a powerful library for .NET, combined with Mailgun API keys, offers developers a seamless solution to enhance email capabilities with reliability and scalability. Later in this article, we will also look at the IronPDF Library on ironsoftware.com to generate and manage PDF documents. FluentEmail simplifies the process of sending multiple emails programmatically within .NET applications. It provides an intuitive and fluent interface for configuring email messages, managing attachments, and handling recipient lists. This library abstracts away the complexities of SMTP configuration and supports multiple template renderer providers and test email service providers, including Mailgun. FluentEmail.NET is a popular library in the .NET Core ecosystem for sending emails, and it supports Razor email templates as well as Liquid templates for creating email bodies dynamically. Using Razor template renderer with FluentEmail.NET allows you to leverage the power of Razor syntax to create well-formatted, dynamic email content and resolve layout files. Here’s a basic guide on how to use FluentEmail.NET with ASP.NET Core Razor templates. Step 1: Install FluentEmail First, you need to install the FluentEmail package and the Razor templates renderer package by either using the Install-Package command or the .NET add package command: # Install packages using the Package Manager Console Install-Package FluentEmail.Core Install-Package FluentEmail.Razor # Or install packages using the .NET CLI dotnet add package FluentEmail.Core dotnet add package FluentEmail.Razor # Install packages using the Package Manager Console Install-Package FluentEmail.Core Install-Package FluentEmail.Razor # Or install packages using the .NET CLI dotnet add package FluentEmail.Core dotnet add package FluentEmail.Razor SHELL Step 2: Create a Razor Template Create a Razor template for your email body. This can be a .cshtml file containing HTML and valid Razor code syntax. For example, create a file named EmailTemplate.cshtml: @model YourNamespace.EmailViewModel <!DOCTYPE html> <html> <head> <title>Email Template</title> </head> <body> <h1>Hello, @Model.Name!</h1> <p>This is a sample email template.</p> </body> </html> @model YourNamespace.EmailViewModel <!DOCTYPE html> <html> <head> <title>Email Template</title> </head> <body> <h1>Hello, @Model.Name!</h1> <p>This is a sample email template.</p> </body> </html> HTML Make sure to replace YourNamespace.EmailViewModel with the actual namespace and class name of your view model or just the domain model that you will pass to this template. Step 3: Set Up FluentEmail with Razor Renderer Configure FluentEmail to use the Razor renderer and provide the necessary dependencies: using FluentEmail.Core; using FluentEmail.Razor; public void ConfigureFluentEmail() { // Set up the Razor renderer Email.DefaultRenderer = new RazorRenderer(); // Set up SMTP sender address Email.DefaultSender = new SmtpSender(new SmtpClient("smtp.yourserver.com")); } using FluentEmail.Core; using FluentEmail.Razor; public void ConfigureFluentEmail() { // Set up the Razor renderer Email.DefaultRenderer = new RazorRenderer(); // Set up SMTP sender address Email.DefaultSender = new SmtpSender(new SmtpClient("smtp.yourserver.com")); } $vbLabelText $csharpLabel Step 4: Render and Send Email In your application code, render the Razor template with the desired model and send the email: using FluentEmail.Core; using FluentEmail.Razor; public void SendEmail() { // Specify the template file var template = "EmailTemplate.cshtml"; // Create the email var email = Email .From("sender@example.com") // Set the sender's email address .To("recipient@example.com") // Set the recipient's email address .Subject("Sample Email"); // Set the email subject // Define the model to pass to the template var model = new EmailViewModel { Name = "John Doe" }; // Render the template with the model email.UsingTemplateFromFile(template, model); // Send the email email.Send(); } using FluentEmail.Core; using FluentEmail.Razor; public void SendEmail() { // Specify the template file var template = "EmailTemplate.cshtml"; // Create the email var email = Email .From("sender@example.com") // Set the sender's email address .To("recipient@example.com") // Set the recipient's email address .Subject("Sample Email"); // Set the email subject // Define the model to pass to the template var model = new EmailViewModel { Name = "John Doe" }; // Render the template with the model email.UsingTemplateFromFile(template, model); // Send the email email.Send(); } $vbLabelText $csharpLabel Ensure that EmailViewModel matches the model defined in your Razor template (EmailTemplate.cshtml). This model should contain properties you reference in your Razor template (@Model.Name, for example). Integrating Mailgun API Keys Mailgun is a popular email service provider known for its reliability, deliverability, and rich features. By integrating Mailgun API keys with FluentEmail, developers can leverage Mailgun's infrastructure to send emails efficiently and securely. Steps to Integrate Mailgun API Keys with FluentEmail Obtain Mailgun API Keys: Sign up for a Mailgun account if you haven't already. Navigate to the Mailgun Dashboard and create a new API key. Provide a description. Install FluentEmail Package: Use NuGet Package Manager or Package Manager Console in Visual Studio to install FluentMail: # Install the FluentEmail.Mailgun package Install-Package FluentEmail.Mailgun # Install the FluentEmail.Mailgun package Install-Package FluentEmail.Mailgun SHELL or from Visual Studio: Configure FluentEmail with Mailgun API Keys: Set up FluentEmail to use Mailgun as the email service provider or SMTP sender by configuring your API keys: using FluentEmail.Core; using FluentEmail.Mailgun; // Create an instance of MailgunSender var sender = new MailgunSender("your-domain.com", "your-mailgun-api-key"); // Set the default sender for all emails Email.DefaultSender = sender; using FluentEmail.Core; using FluentEmail.Mailgun; // Create an instance of MailgunSender var sender = new MailgunSender("your-domain.com", "your-mailgun-api-key"); // Set the default sender for all emails Email.DefaultSender = sender; $vbLabelText $csharpLabel Compose and Send Emails: Use FluentEmail's fluent interface to compose and send emails: var email = Email .From("sender@example.com") .To("recipient@example.com") .Subject("Your Subject Here") .Body("Hello, this is a test email sent via FluentMail and Mailgun!") .Send(); var email = Email .From("sender@example.com") .To("recipient@example.com") .Subject("Your Subject Here") .Body("Hello, this is a test email sent via FluentMail and Mailgun!") .Send(); $vbLabelText $csharpLabel Advanced Configuration: Customize email settings such as attachments, HTML formatting, CC/BCC recipients, and email headers using FluentEmail's fluent API. Benefits of Using FluentEmail with Mailgun Simplicity: FluentEmail abstracts away the complexities of SMTP configuration, making it easy to send emails with minimal setup. Reliability: Leveraging Mailgun's infrastructure ensures high deliverability rates and robust email handling capabilities. Scalability: Scale your email-sending needs effortlessly with Mailgun's scalable infrastructure, suitable for both small-scale applications and enterprise-level solutions. Rich Features: Take advantage of Mailgun's features such as tracking, analytics, and advanced email validation to optimize your email campaigns. Introduction to IronPDF IronPDF is a Node.js PDF library that allows generating, managing, and extracting content from PDF documents in .NET projects. Here are some key features: HTML to PDF Conversion: Convert HTML, CSS, and JavaScript content to PDF Documents. Chrome Rendering Engine for pixel-perfect PDFs. Generate PDFs from URLs, HTML files, or HTML strings as input. Image and Content Conversion: Convert images to and from PDFs. Extract text and images from existing PDF documents. Support for various image formats like JPG, PNG, etc. Editing and Manipulation: Set properties, security, and permissions for PDFs. Add digital signatures. Edit metadata and revision history. IronPDF excels in HTML to PDF conversion, ensuring precise preservation of original layouts and styles. It's perfect for creating PDFs from web-based content such as reports, invoices, and documentation. With support for HTML files, URLs, and raw HTML strings, IronPDF easily produces high-quality PDF documents. using IronPdf; class Program { static void Main(string[] args) { // Create a ChromePdfRenderer instance var renderer = new ChromePdfRenderer(); // 1. Convert HTML String to PDF var htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF from an HTML string.</p>"; var pdfFromHtmlString = renderer.RenderHtmlAsPdf(htmlContent); pdfFromHtmlString.SaveAs("HTMLStringToPDF.pdf"); // 2. Convert HTML File to PDF var htmlFilePath = "path_to_your_html_file.html"; // Specify the path to your HTML file var pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf(htmlFilePath); pdfFromHtmlFile.SaveAs("HTMLFileToPDF.pdf"); // 3. Convert URL to PDF var url = "http://ironpdf.com"; // Specify the URL var pdfFromUrl = renderer.RenderUrlAsPdf(url); pdfFromUrl.SaveAs("URLToPDF.pdf"); } } using IronPdf; class Program { static void Main(string[] args) { // Create a ChromePdfRenderer instance var renderer = new ChromePdfRenderer(); // 1. Convert HTML String to PDF var htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF from an HTML string.</p>"; var pdfFromHtmlString = renderer.RenderHtmlAsPdf(htmlContent); pdfFromHtmlString.SaveAs("HTMLStringToPDF.pdf"); // 2. Convert HTML File to PDF var htmlFilePath = "path_to_your_html_file.html"; // Specify the path to your HTML file var pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf(htmlFilePath); pdfFromHtmlFile.SaveAs("HTMLFileToPDF.pdf"); // 3. Convert URL to PDF var url = "http://ironpdf.com"; // Specify the URL var pdfFromUrl = renderer.RenderUrlAsPdf(url); pdfFromUrl.SaveAs("URLToPDF.pdf"); } } $vbLabelText $csharpLabel Generate PDF document Using IronPDF And FluentEmail .NET with Mailgun sender To start with, create a Console application using Visual Studio as below. Provide Project Name. Provide .NET Version. Install IronPDF package. Install FluentEmail Mailgun. To receive email messages in the free trial, the receiver email should be registered in the dashboard on the Mailgun Registration Dashboard as shown below. using FluentEmail.Core; using FluentEmail.Mailgun; using IronPdf; using System; using System.IO; namespace CodeSample { public static class FluentMailDemo { public static void Execute() { // Instantiate Renderer var renderer = new ChromePdfRenderer(); // HTML Content to be converted into PDF and used in Email var content = "<h1>Demo FluentEmail with Mailgun and IronPDF</h1>"; content += "<h2>Create MailgunSender</h2>"; content += "<p>1. Get API key from app.mailgun.com</p>"; var domain = "your-domain.com"; // Use your Mailgun domain var sender = new MailgunSender(domain, "your-mailgun-api-key"); // Use your Mailgun API key Email.DefaultSender = sender; content += "<h2>Prepare Email</h2>"; content += $"<p>Sender: example@{domain}</p>"; content += $"<p>Receiver: recipient@example.com</p>"; content += $"<p>Subject: Checkout the New Awesome IronPDF Library from Iron Software</p>"; content += $"<p>Body: IronPDF is the leading C# PDF library for generating & editing PDFs. It has friendly API and allows developers to rapidly deliver high quality PDFs from HTML in .NET projects.</p>"; // Render HTML content to PDF var pdf = renderer.RenderHtmlAsPdf(content); // Export the PDF to a file pdf.SaveAs("AwesomeFluentEmailAndIron.pdf"); // Compose and send the email var email = Email .From($"example@{domain}") .To("recipient@example.com") .Subject("Checkout the New Awesome IronPDF Library from Iron Software") .Body("IronPDF is the leading C# PDF library for generating & editing PDFs. It has a friendly API and allows developers to rapidly deliver high quality PDFs from HTML in .NET projects.") .Attach(new FluentEmail.Core.Models.Attachment { Data = File.OpenRead("AwesomeFluentEmailAndIron.pdf"), Filename = "AwesomeFluentEmailAndIron.pdf", ContentType = "application/pdf" }) .Send(); Console.WriteLine($"Is Send Success: {email.Successful}"); } } } using FluentEmail.Core; using FluentEmail.Mailgun; using IronPdf; using System; using System.IO; namespace CodeSample { public static class FluentMailDemo { public static void Execute() { // Instantiate Renderer var renderer = new ChromePdfRenderer(); // HTML Content to be converted into PDF and used in Email var content = "<h1>Demo FluentEmail with Mailgun and IronPDF</h1>"; content += "<h2>Create MailgunSender</h2>"; content += "<p>1. Get API key from app.mailgun.com</p>"; var domain = "your-domain.com"; // Use your Mailgun domain var sender = new MailgunSender(domain, "your-mailgun-api-key"); // Use your Mailgun API key Email.DefaultSender = sender; content += "<h2>Prepare Email</h2>"; content += $"<p>Sender: example@{domain}</p>"; content += $"<p>Receiver: recipient@example.com</p>"; content += $"<p>Subject: Checkout the New Awesome IronPDF Library from Iron Software</p>"; content += $"<p>Body: IronPDF is the leading C# PDF library for generating & editing PDFs. It has friendly API and allows developers to rapidly deliver high quality PDFs from HTML in .NET projects.</p>"; // Render HTML content to PDF var pdf = renderer.RenderHtmlAsPdf(content); // Export the PDF to a file pdf.SaveAs("AwesomeFluentEmailAndIron.pdf"); // Compose and send the email var email = Email .From($"example@{domain}") .To("recipient@example.com") .Subject("Checkout the New Awesome IronPDF Library from Iron Software") .Body("IronPDF is the leading C# PDF library for generating & editing PDFs. It has a friendly API and allows developers to rapidly deliver high quality PDFs from HTML in .NET projects.") .Attach(new FluentEmail.Core.Models.Attachment { Data = File.OpenRead("AwesomeFluentEmailAndIron.pdf"), Filename = "AwesomeFluentEmailAndIron.pdf", ContentType = "application/pdf" }) .Send(); Console.WriteLine($"Is Send Success: {email.Successful}"); } } } $vbLabelText $csharpLabel Code Explanation FluentEmail and Mailgun Integration: FluentEmail.Core: Provides a fluent interface for composing and sending emails. FluentEmail.Mailgun: Enables integration with Mailgun for email delivery. ChromePdfRenderer: This is assumed to be an instance of ChromePdfRenderer from the IronPDF library, used to render HTML content into a PDF document. Content Preparation: HTML content (content) is prepared, including details about IronPDF. This content is used both for generating the PDF (renderer.RenderHtmlAsPdf(content)) and for the email body. MailgunSender Setup: MailgunSender is initialized with Mailgun API credentials (domain and API key). The Email.DefaultSender is set to this sender, ensuring all subsequent emails use Mailgun for delivery. PDF Generation and Attachment: The HTML content (content) is rendered into a PDF (pdf) using IronPDF's RenderHtmlAsPdf method. The generated PDF is saved as "AwesomeFluentEmailAndIron.pdf". Email Composition and Sending: An email is composed using FluentEmail's fluent API: The 'From' address is set using the sender's domain. The 'To' address is set to the recipient's email. The subject and body of the email are defined. The PDF file "AwesomeFluentEmailAndIron.pdf" is attached to the email. The email is sent using .Send(), and the success status (email.Successful) is printed to the console. Console Output: After attempting to send the email, the code outputs whether the email was sent successfully (Is Send Success: true/false). Output Email Message Attached PDF IronPDF Licensing IronPDF package requires a license to run and generate the PDF. Add below code at the start of the application before the package is accessed. IronPdf.License.LicenseKey = "IRONPDF-LICENSE-KEY"; IronPdf.License.LicenseKey = "IRONPDF-LICENSE-KEY"; $vbLabelText $csharpLabel Trial License is available at IronPDF Licensing and Trial. Conclusion FluentEmail, combined with Mailgun API keys, empowers .NET developers to streamline email functionality within their applications. Whether sending transactional emails, newsletters, or notifications, this integration ensures reliability, scalability, and ease of use. By abstracting the complexities of email delivery, FluentEmail allows developers to focus on building robust applications while leveraging Mailgun's powerful email infrastructure. Embrace the power of FluentEmail and Mailgun to enhance your email communication capabilities in .NET applications today. IronPDF on the other hand is a robust C# library for creating, editing, and converting PDF documents within .NET applications. It excels in HTML to PDF conversion, offers comprehensive PDF manipulation capabilities, and integrates seamlessly with .NET frameworks, providing secure and versatile PDF handling solutions. 자주 묻는 질문 .NET 애플리케이션에서 Razor 템플릿을 사용하여 이메일을 보내려면 어떻게 해야 하나요? FluentEmail을 사용하여 .NET 애플리케이션에서 Razor 템플릿으로 이메일을 보낼 수 있습니다. 먼저 NuGet 또는 .NET CLI를 사용하여 FluentEmail과 Razor 렌더러 패키지를 설치합니다. 그런 다음, Razor 렌더러를 구성하고 FluentEmail 인터페이스를 사용하여 Razor 템플릿을 지원하는 이메일을 작성하고 전송합니다. Mailgun을 .NET 이메일 라이브러리와 통합하려면 어떻게 해야 하나요? Mailgun과 FluentEmail을 통합하려면 Mailgun 대시보드에서 API 키를 받습니다. 그런 다음 `FluentEmail.Mailgun` 패키지를 설치하고 Mailgun을 이메일 서비스 제공업체로 구성하면 Mailgun의 인프라를 통해 효율적으로 이메일을 보낼 수 있습니다. .NET의 이메일 기능에 FluentEmail을 사용하면 어떤 이점이 있나요? FluentEmail은 이메일 작성 및 전송을 위한 유창한 인터페이스를 제공하고, 동적 콘텐츠를 위한 Razor 및 Liquid 템플릿을 지원하며, SMTP 구성을 간소화하고, 안정적이고 확장 가능한 이메일 전송을 위해 Mailgun과 통합되어 있습니다. .NET 라이브러리를 사용하여 ASP.NET Core에서 이메일 알림을 자동화할 수 있나요? 예, FluentEmail을 사용하여 ASP.NET Core에서 이메일 알림을 자동화할 수 있습니다. Razor 템플릿과 Mailgun 통합을 활용하여 트랜잭션 이메일, 뉴스레터 및 알림 전송을 쉽게 자동화할 수 있습니다. .NET에서 FluentEmail을 사용하여 이메일 첨부 파일을 처리하려면 어떻게 해야 하나요? FluentEmail을 사용하면 이메일 작성 시 첨부 파일을 추가하여 이메일 첨부 파일을 쉽게 관리할 수 있습니다. 이 라이브러리는 이메일에 파일을 첨부하는 방법을 제공하여 이메일 콘텐츠와 함께 첨부 파일을 전송할 수 있도록 합니다. IronPDF는 .NET 애플리케이션의 PDF 기능을 어떻게 향상시키나요? IronPDF는 HTML을 PDF로 변환, 콘텐츠 추출 및 포괄적인 PDF 편집 기능을 제공하여 PDF 기능을 향상시킵니다. Chrome 렌더링 엔진을 사용하여 개발자가 HTML에서 PDF를 생성하고, 콘텐츠를 추출하고, PDF를 효율적으로 수정할 수 있습니다. .NET 애플리케이션에서 HTML을 PDF로 변환하려면 어떤 단계가 필요하나요? IronPDF를 사용하여 .NET 애플리케이션에서 HTML을 PDF로 변환하려면 `ChromePdfRenderer` 클래스를 사용하여 HTML 콘텐츠를 PDF 문서로 렌더링할 수 있습니다. 그런 다음 이 PDF를 파일로 저장하거나 필요에 따라 추가로 조작할 수 있습니다. .NET 애플리케이션에서 이메일에 PDF를 첨부하려면 어떻게 해야 하나요? .NET 애플리케이션에서 이메일에 PDF를 첨부하려면 먼저 IronPDF를 사용하여 PDF를 생성하세요. PDF가 생성되면 FluentEmail을 사용하여 이메일을 작성하고 이메일을 보내기 전에 파일 첨부에 사용할 수 있는 방법을 사용하여 PDF 파일을 첨부합니다. .NET 라이브러리를 사용하여 PDF에서 콘텐츠를 추출할 수 있나요? 예, IronPDF를 사용하면 PDF에서 콘텐츠를 추출할 수 있습니다. 이 라이브러리는 PDF 문서에서 텍스트와 이미지를 읽는 방법을 제공하여 추가 처리 또는 분석을 위해 콘텐츠를 추출할 수 있습니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기 업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기 업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기 Entity Framework Core (How It Works For Developers)LazyCache C# (How It Works For Deve...
업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기
업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기
업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기