This repository hosts a .NET8 application designed to facilitate the sending of emails with HTML body content and optional attachments. Leveraging ASP.NET 8 MVC, it provides a user-friendly interface for users to compose and send emails directly from the web application.
- Email Composition: Users can compose emails with customizable HTML body content.
- Attachment Support: Option to attach files to the email, enhancing its functionality.
- Validation: Utilizes Data Annotations for input validation to ensure proper data integrity.
- Configuration: Email sender credentials can be configured via the
appsettings.jsonfile. - Logging: Integrated logging functionality to capture errors and information during email transmission.
- Dependency Injection: Utilizes dependency injection to manage and inject services like the email service.
- .NET8 SDK
- Visual Studio or Visual Studio Code (optional)
- Clone this repository to your local machine.
- Open the solution in Visual Studio or Visual Studio Code.
- Build the solution to restore dependencies.
- Configure email sender credentials in the
appsettings.jsonfile under theEmailsection. - Run the application.
- Navigate to the home page.
- Fill out the form with the recipient's email address, email subject, and email body.
- Optionally attach files if needed.
- Click the "Send Mail" button to dispatch the email.
- File Input: Includes a file input feature for attaching files to emails. Ensure the necessary CSS and JavaScript files are included in your project.
- Notifications: Utilizes alertify for displaying success and error notifications. Ensure the alertify library files are included in your project.
EmailModel.cs: Defines the model for email composition with properties for recipient email, subject, and body.IEmailService.cs: Interface outlining methods for the email service.EmailService.cs: Implements the email service for sending emails with HTML content and attachments.Index.cshtml: Razor view for the home page featuring the email composition form.EmailTemplate.txt: HTML template file used for formatting the email body.
System.Net.Mail: Provides functionality for sending emails.System.Net: Essential for network operations.Microsoft.Extensions.Configuration: Enables access to application configuration.Microsoft.Extensions.Logging: Facilitates logging of errors and information.
Visit this link for the Demo :http://emailhtmlcore.runasp.net/
Contributions are encouraged! Please feel free to submit issues or pull requests for enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please reach out via clementomolayo.net@gmail.com.