public static void HandlePostMessage(MailMessage message) { using (SmtpClient smtpClient = SmtpUtil.CreateSmtpClient()) { smtpClient.Send(message); } }
static void SendSupportEmail(Trade trade, SkuView sku, string sellerName, string sellerPhone) { string templateBody = GetTemplateBody("~/templates/tradeNotice.txt", "en-US"); templateBody = templateBody.Replace("{TradeCode}", trade.TradeCode); templateBody = templateBody.Replace("{Quantity}", trade.Quantity.ToString()); templateBody = templateBody.Replace("{SkuName}", sku.FullName); templateBody = templateBody.Replace("{Total}", trade.Total.ToString()); templateBody = templateBody.Replace("{Currency}", trade.Currency); templateBody = templateBody.Replace("{BuyerName}", trade.BuyerUserName); templateBody = templateBody.Replace("{BuyerPhone}", trade.BuyerPhoneNumber); templateBody = templateBody.Replace("{SellerName}", sellerName); templateBody = templateBody.Replace("{SellerPhone}", sellerPhone); MailMessage message = new MailMessage(WebApplication.Instance.SmtpSettings.Username, WebApplication.Instance.SupportEmail); message.Subject = String.Format("Trade Notice {0}", trade.TradeCode); message.Body = templateBody; message.IsBodyHtml = false; SmtpClient smtpClient = SmtpUtil.CreateSmtpClient(); smtpClient.SendAsync(message, null); }
static void SendEmail(MailMessage msg) { SmtpClient smtpClient = SmtpUtil.CreateSmtpClient(); smtpClient.SendAsync(msg, null); }