Last active
March 26, 2019 22:24
-
-
Save mikebrind/14e749aded8a6bbfe9df4d3e92b9a296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Mail; | |
using System.Threading.Tasks; | |
namespace RazorPartialToString.Services | |
{ | |
public class DemoEmailService : IEmailService | |
{ | |
public async Task SendAsync(string email, string name, string subject, string body) | |
{ | |
using (var smtp = new SmtpClient()) | |
{ | |
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; | |
smtp.PickupDirectoryLocation = @"c:\maildump"; | |
var message = new MailMessage | |
{ | |
Body = body, | |
Subject = subject, | |
From = new MailAddress(email, name), | |
IsBodyHtml = true | |
}; | |
message.To.Add("contact@domain.com"); | |
await smtp.SendMailAsync(message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment