This is a simple ASP .NET Core Web API to send E-mails using MailKit and Mailtrap free service.
The motivation for this project is to send e-emails in batches to have success contact with my college course coordinator, as he never responds.
- Clone the repository
- Inside of the
sln
directory, restore the dependencies withdotnet restore
- Change the directory to AutomaticMailSenderPOC with
cd AutomaticMailSenderPOC
and execute the project withdotnet run
- After that, you either have to init and create an user-secret or manually populate the
appsettings.json
file to bind some data.
- Include the following code in the configuration file:
"SmtpSettings": {
"Server": "sandbox.smtp.mailtrap.io",
"Port": 2525,
"SenderEmail": "[email protected]",
"Username": "Your Username",
"Password": "Your safe password",
"MailTrapUserName": "Your Mailtrap Username",
"MailTrapPassword": "Your Mailtrap Password"
}
- Inside the
csproj
directory, initialize the user secrets with:dotnet user-secrets init
- Then, one by one, type the following in the terminal:
dotnet user-secrets set "SmtpSettings:Server" "sandbox.smtp.mailtrap.io"
dotnet user-secrets set "SmtpSettings:Port" "2525"
dotnet user-secrets set "SmtpSettings:SenderEmail" "[email protected]"
dotnet user-secrets set "SmtpSettings:Username" "Your Username"
dotnet user-secrets set "SmtpSettings:Password" "Your safe password"
dotnet user-secrets set "SmtpSettings:MailTrapUserName" "Your MailTrap Username"
dotnet user-secrets set "SmtpSettings:MailTrapPassword" "Your MailTrap Password"
MailKit Documentation
MailKit GitHub Project