public string SaveEmail(Email email) { try { Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand("Email_Insert")) { db.AddInParameter(cmd, "@_clientId", DbType.String, email.ClientId); db.AddInParameter(cmd, "@_fromEmail", DbType.String, email.FromEmail); db.AddInParameter(cmd, "@_fromName", DbType.String, email.FromName); db.AddInParameter(cmd, "@_toEmail", DbType.String, email.ToEmail); db.AddInParameter(cmd, "@_toName", DbType.String, email.ToName); db.AddInParameter(cmd, "@_htmlBody", DbType.String, email.HtmlBody); db.AddInParameter(cmd, "@_subject", DbType.String, email.Subject); db.ExecuteNonQuery(cmd); } return "success"; } catch (Exception ex) { //Handle error return ex.Message; } }
public string SendHtmlEmail(string subject, string body, bool isHtml, string fromEmail, string fromName, string toEmail, string toName) { Result result = ServiceHelper.CheckSoapHeader(MailSoapHeader); if (result.Status == 0) { try { result.Message = EmailManager.SendEmail(subject, body, isHtml, fromEmail, fromEmail, toEmail, toEmail); if (result.Message.Equals("success")) { Email email = new Email(); email.ClientId = MailSoapHeader.ClientId; email.Subject = subject; email.HtmlBody = body; email.ToEmail = toEmail; email.ToName = toName; email.FromEmail = fromEmail; email.FromName = fromName; result.Message = EmailManager.SaveEmail(email); } } catch (Exception ex) { result.Status = 1; result.Message = ex.Message; } } return ResultManager.Serialize(result); }
public static string SaveEmail(Email email) { return EmailDataProvider.Instance.SaveEmail(email); }