本文整理汇总了C#中IEmailService.SendEmail方法的典型用法代码示例。如果您正苦于以下问题:C# IEmailService.SendEmail方法的具体用法?C# IEmailService.SendEmail怎么用?C# IEmailService.SendEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEmailService
的用法示例。
在下文中一共展示了IEmailService.SendEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public bool Process(Message message)
{
_formattingService = new FormattingServices();
_transactionBatchService = new TransactionBatchService(_ctx, _logger);
_validationService = new ValidationService(_logger);
_smsService = new SMSService(_ctx);
_emailService = new EmailService(_ctx);
_userService = new UserService(_ctx);
_messageService = new MessageServices(_ctx);
string fromAddress = "[email protected]";
URIType recipientType = _messageService.GetURIType(message.RecipientUri);
_logger.Log(LogLevel.Info, String.Format("Processing Payment Message to {0}", message.RecipientUri));
_logger.Log(LogLevel.Info, String.Format("URI Type {0}", recipientType));
string smsMessage;
string emailSubject;
string emailBody;
var sender = message.Sender;
var recipient = _userService.GetUser(message.RecipientUri);
message.Recipient = recipient;
var senderName = _userService.GetSenderName(sender);
var recipientName = message.RecipientUri;
//check to see if recipient uri is mobile #, email address, or ME code
//Validate Payment
//Batch Transacations
_logger.Log(LogLevel.Info, String.Format("Batching Transactions for message {0}", message.Id));
try
{
_transactionBatchService.BatchTransactions(message);
}
catch (Exception ex)
{
_logger.Log(LogLevel.Error, String.Format("Unable to process message {0}. {1}", message.Id, ex.Message));
throw ex;
}
//Attempt to assign payment to Payee
if (recipient != null)
{
recipientName = recipient.UserName;
if (!String.IsNullOrEmpty(recipient.SenderName))
recipientName = recipient.SenderName;
else if (!String.IsNullOrEmpty(recipient.MobileNumber))
recipientName = _formattingService.FormatMobileNumber(recipient.MobileNumber);
//Send out SMS Message to recipient
if (!String.IsNullOrEmpty(recipient.MobileNumber))
{
_logger.Log(LogLevel.Info, String.Format("Send SMS to Recipient"));
smsMessage = String.Format(_recipientSMSMessage, message.Amount, senderName, _mobileWebSiteUrl);
_smsService.SendSMS(message.ApiKey, recipient.MobileNumber, smsMessage);
}
//Send SMS Message to sender
if (!String.IsNullOrEmpty(sender.MobileNumber))
{
_logger.Log(LogLevel.Info, String.Format("Send SMS to Sender"));
smsMessage = String.Format(_senderSMSMessage, message.Amount, recipientName, _mobileWebSiteUrl);
_smsService.SendSMS(message.ApiKey, sender.MobileNumber, smsMessage);
}
//Send confirmation email to sender
if (!String.IsNullOrEmpty(sender.EmailAddress))
{
_logger.Log(LogLevel.Info, String.Format("Sending Email Confirmation to Sender"));
emailSubject = String.Format(_senderConfirmationEmailSubject, recipientName);
emailBody = String.Format(_senderConfirmationEmailBody, recipientName, message.Amount, _mobileWebSiteUrl);
_emailService.SendEmail(message.ApiKey, fromAddress, sender.EmailAddress, emailSubject, emailBody);
}
//Send confirmation email to recipient
if (!String.IsNullOrEmpty(recipient.EmailAddress))
{
_logger.Log(LogLevel.Info, String.Format("Sending Email Confirmation to Recipient"));
emailSubject = String.Format(_recipientConfirmationEmailSubject, senderName, message.Amount);
//Payment Registered Recipient
//first_name
//last_name
//rec_amount
//rec_sender
//rec_sender_photo_url
//rec_datetime formatted dddd, MMMM dd(rd) at hh:mm tt
//rec_comments
//app_user
//link_registration - empty
_emailService.SendEmail(recipient.EmailAddress, emailSubject, _paymentReceivedRecipientRegisteredTemplate, new List<KeyValuePair<string, string>>()
//.........这里部分代码省略.........