public async Task <ActionResult> SendMail(MailViewModel model)
        {
            var message = new IdentityMessage
            {
                Body        = _mailHandler.GetMailMessage(model, "EmailTemplate.cshtml"),
                Destination = model.Email,
                Subject     = model.Subject
            };

            await _emailService.SendAsync(message);

            return(Json("Ok", JsonRequestBehavior.AllowGet));
        }
Example #2
0
        private void HandleMail(IEnumerable <SmtpArgument> commandArguments)
        {
            if (!_helloGiven)
            {
                _client.Write("503 HELO/EHLO Command not issued");
                return;
            }

            MailMessage message;

            try
            {
                message = _mailHandler.GetMailMessage(commandArguments.ToArray(), _client);
            }
            catch (SmtpErrorException smtpErrorException)
            {
                _client.Write(smtpErrorException.SMTPResponse);
                _logger.Error("Error getting mail message: {0}", smtpErrorException.SMTPResponse);
            }
            _client.ClearLastCommand();
        }