public void SendEmail(AspxCommonInfo aspxCommonObj, ReferToFriendEmailInfo referToFriendObj, WishItemEmailInfo messageBodyDetail) { try { EmailTemplate.SendEmailForReferFriend(aspxCommonObj, referToFriendObj, messageBodyDetail); } catch(Exception ex) { throw ex; } }
//-------------------------Save AND SendEmail Messages For Refer-A-Friend---------------- public static void SaveAndSendEmailMessage(AspxCommonInfo aspxCommonObj, ReferToFriendEmailInfo referToFriendObj, WishItemEmailInfo messageBodyDetail) { try { AspxReferFriendProvider.SaveAndSendEmailMessage(aspxCommonObj, referToFriendObj, messageBodyDetail); } catch (Exception e) { throw e; } }
public void SendEmail(AspxCommonInfo aspxCommonObj, ReferToFriendEmailInfo referToFriendObj, WishItemEmailInfo messageBodyDetail) { try { EmailTemplate.SendEmailForReferFriend(aspxCommonObj, referToFriendObj, messageBodyDetail); } catch (Exception ex) { throw ex; } }
//-------------------------Save AND SendEmail Messages For Refer-A-Friend---------------- public static void SaveAndSendEmailMessage(AspxCommonInfo aspxCommonObj, ReferToFriendEmailInfo referToFriendObj, WishItemEmailInfo messageBodyDetail) { try { SaveEmailMessage(aspxCommonObj, referToFriendObj); SendEmail(aspxCommonObj, referToFriendObj, messageBodyDetail); } catch (Exception e) { throw e; } }
public static void SendEmailForReferFriend(AspxCommonInfo aspxCommonObj, ReferToFriendEmailInfo referToFriendObj, WishItemEmailInfo messageBodyDetail) { var messageBodyHtml = ""; messageBodyHtml += "<table style='font:12px Arial, Helvetica, sans-serif;' width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"; messageBodyHtml += "<td width='33%'><div style='border:1px solid #cfcfcf; background:#f1f1f1; padding:10px; text-align:center;'>"; messageBodyHtml += "<img src='" + messageBodyDetail.src + "' alt='" + messageBodyDetail.alt + "' width='250' />"; messageBodyHtml += "<p style='margin:0; padding:5px 0 0 0; font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; line-height:18px;'> <span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'>"; messageBodyHtml += messageBodyDetail.title + "</span><br />"; messageBodyHtml += "<span style='font-weight:bold; font-size:11px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'>Price:</span>"; messageBodyHtml += messageBodyDetail.price + "<br />"; // messageBodyHtml += "<span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif;text-decoration:blink; text-shadow:1px 1px 0 #fff;'><a style='color: rgb(39, 142, 230);' href='" + href + "'>' + getLocale(AspxReferToFriend, 'click here to view all details') + '</a></span> "; messageBodyHtml += "<span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif;text-decoration:blink; text-shadow:1px 1px 0 #fff;'><a style='color: rgb(39, 142, 230);' href='" + messageBodyDetail.href + "'>click here to view all details</a></span>"; messageBodyHtml += "</p> </div></td></tr> </table>"; StoreSettingConfig ssc = new StoreSettingConfig(); string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName); List<MessageManagementInfo> template = MessageManagementController.GetMessageTemplateByMessageTemplateTypeID( SystemSetting.REFER_A_FRIEND_EMAIL, aspxCommonObj.PortalID); foreach (MessageManagementInfo messageToken in template) { string messageTemplate = messageToken.Body.ToString(); string src = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/"; if (messageToken != null) { string[] tokens = GetAllToken(messageTemplate); foreach (string token in tokens) { switch (token) { case "%DateTime%": messageTemplate = messageTemplate.Replace(token, System.DateTime.Now.ToString("MM/dd/yyyy")); break; case "%Username%": messageTemplate = messageTemplate.Replace(token, referToFriendObj.SenderName); break; //case "%senderEmail%": // messageTemplate = messageTemplate.Replace(token, senderEmail); // break; case "%MessageDetails%": messageTemplate = messageTemplate.Replace(token, referToFriendObj.Message); break; case "%ItemDetailsTable%": messageTemplate = messageTemplate.Replace(token, messageBodyHtml); break; case "%LogoSource%": string imgSrc = "http://" + src + logosrc; messageTemplate = messageTemplate.Replace(token, imgSrc); break; case "%serverPath%": messageTemplate = messageTemplate.Replace(token, "http://" + src); break; case "%DateYear%": messageTemplate = messageTemplate.Replace(token, System.DateTime.Now.Year.ToString()); break; } } } string emailSuperAdmin; string emailSiteAdmin; SageFrameConfig pagebase = new SageFrameConfig(); emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail); emailSiteAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress); MailHelper.SendMailNoAttachment(referToFriendObj.SenderEmail, referToFriendObj.ReceiverEmail, referToFriendObj.Subject, messageTemplate, emailSiteAdmin, emailSuperAdmin); } }