Created
February 16, 2021 12:42
-
-
Save jzwang-dev/56721f7cd888c2da839505851ea23d33 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
[HttpPost] | |
public ActionResult SendOrderEmail() | |
{ | |
var order = Models.OrderUtil.GetTestOrder(); | |
string subject = "測試主旨"; | |
ViewBag.remark = "寄送時間:" + DateTime.Now; | |
string body = JZLib.JZUtil.RenderViewToString(ControllerContext, "_OrderEmailTemplate", order); | |
using (SmtpClient smtp = new SmtpClient("your.smtp.server")) | |
{ | |
smtp.Send(new MailMessage("noreply@jzcorp.com", order.customer_email) | |
{ | |
Subject = subject, | |
Body = body, | |
IsBodyHtml = true | |
}); | |
} | |
return View("MailSent"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment