public void SendContactEmail(string fromEmail, string name, string message) { var header = EmailHeader(); var body = string.Format("Regarding: {0}",message); var emailBody = header.Replace("[Body]", body); string fromName = name; const int emailAccountId = 1; var email = new QueuedEmail() { Priority = 5, From = fromEmail, FromName = fromName, To = "*****@*****.**", EmailName = "Contact Email", ToName = "Contact", CC = string.Empty, Bcc = string.Empty, Subject = "Tool Depot Inquiry", Body = emailBody, CreatedOnUtc = DateTime.UtcNow, EmailAccountId = emailAccountId }; _queuedEmailService.Add(email); }
//, EmailAccount templateEmailAccount) private int SendNotification(EmailTemplates messageTemplate, IEnumerable<Token> tokens, string toEmail, string toName) { if (messageTemplate == null) { return 0; } var header = EmailHeader(); var body = header.Replace("[Body]", messageTemplate.Body); var subject = messageTemplate.Subject; var bcc = messageTemplate.BccEmailAddresses; var subjectReplaced = _tokenizer.Replace(subject, tokens, false); var bodyReplaced = _tokenizer.Replace(body, tokens, true); string fromEmail = "*****@*****.**"; string fromName = "Tool Depot"; int emailAccountId = 1; var email = new QueuedEmail() { Priority = 5, From = fromEmail, FromName = fromName, To = toEmail, EmailName = messageTemplate.Name, ToName = toName, CC = string.Empty, Bcc = bcc, Subject = subjectReplaced, Body = bodyReplaced, CreatedOnUtc = DateTime.UtcNow, EmailAccountId = emailAccountId }; _queuedEmailService.Add(email); return email.Id; }