コード例 #1
0
ファイル: EmailHelper.cs プロジェクト: anuj130989/ioschools
        /// <summary>
        /// non TModel partial views
        /// </summary>
        /// <param name="type"></param>
        /// <param name="viewData"></param>
        /// <param name="subject"></param>
        /// <param name="destEmail"></param>
        /// <param name="destName"></param>
        /// <param name="ownerid"></param>
        /// <param name="cclist"></param>
        /// <param name="queueMail"></param>
        public static void SendEmail(EmailViewType type,
                                     ViewDataDictionary viewData, string subject, string destEmail, string destName, IEnumerable <string> cclist = null, bool queueMail = true)
        {
            string body = ViewHelpers.RenderViewToString(type.ToDescriptionString(), viewData);

            // wrap body with div to format it
            body = string.Concat("<div style=\"font: 12px/18px arial, sans-serif;\"", body, "</div>");
            Email.SendMail(destName, destEmail, subject, body, queueMail, cclist);
        }
コード例 #2
0
        /// <summary>
        /// non TModel partial views
        /// </summary>
        /// <param name="type"></param>
        /// <param name="viewData"></param>
        /// <param name="subject"></param>
        /// <param name="destEmail"></param>
        /// <param name="destName"></param>
        /// <param name="ownerid"></param>
        public static void SendEmail(EmailViewType type,
                                     ViewDataDictionary viewData, string subject, string destEmail, string destName, user sender, bool queueMail = true)
        {
            string body = ViewHelpers.RenderViewToString(type.ToDescriptionString(), viewData);

            // wrap body with div to format it
            body = string.Format("<style type='text/css'>{0}</style>{1}<div>{2}</div>",
                                 string.Join("", styles),
                                 tradelrLogoPath,
                                 body);
            Email.SendMail(destName, destEmail, subject, body, sender, queueMail);
        }
コード例 #3
0
        public static void SendEmail(this Controller controller, EmailViewType type,
                                     object viewData, string subject, string destEmail, string destName, user sender)
        {
            string body = controller.RenderViewToString(type.ToDescriptionString(), viewData);

            // wrap body with div to format it
            body = string.Format("<style type='text/css'>{0}</style>{1}<div>{2}</div>",
                                 string.Join("", styles),
                                 sender.ToLogo(),
                                 body);

            Email.SendMail(destName, destEmail, subject, body, sender, true);
        }
コード例 #4
0
ファイル: EmailHelper.cs プロジェクト: anuj130989/ioschools
        public static void SendEmail(this Controller controller, EmailViewType type,
                                     object viewData, string subject, string destEmail, string destName, string sourceEmail = "", IEnumerable <string> cclist = null, bool queue = true)
        {
            string body = controller.RenderViewToString(type.ToDescriptionString(), viewData);

            // wrap body with div to format it
            body = string.Concat("<div style=\"font: 12px/18px arial, sans-serif;\"", body, "</div>");
            if (!string.IsNullOrEmpty(sourceEmail))
            {
                Email.SendMail("", sourceEmail, destName, destEmail, subject, body, queue, cclist);
            }
            else
            {
                Email.SendMail(destName, destEmail, subject, body, queue, cclist);
            }
        }
コード例 #5
0
ファイル: EmailHelper.cs プロジェクト: anuj130989/ioschools
 public static void SendEmailNow(EmailViewType type,
                                 ViewDataDictionary viewData, string subject, string destEmail, string destName, IEnumerable <string> cclist = null)
 {
     SendEmail(type, viewData, subject, destEmail, destName, cclist, false);
 }
コード例 #6
0
ファイル: EmailHelper.cs プロジェクト: anuj130989/ioschools
 public static void SendEmailNow(this Controller controller, EmailViewType type,
                                 object viewData, string subject, string destEmail, string destName, string sourceEmail = "", IEnumerable <string> cclist = null)
 {
     controller.SendEmail(type, viewData, subject, destEmail, destName, sourceEmail, cclist, false);
 }
コード例 #7
0
 public static void SendEmailNow(EmailViewType type,
                                 ViewDataDictionary viewData, string subject, string destEmail, string destName, user sender)
 {
     SendEmail(type, viewData, subject, destEmail, destName, sender, false);
 }
コード例 #8
0
        public ErrorData SendMessage(Controller controller, ITradelrRepository repository, EmailViewType emailtype,
                                     object viewData, string subject, string viewloc = "", MessageType msgtype = MessageType.EMAIL)
        {
            // save notification types
            switch (msgtype)
            {
            case MessageType.LINKREQUEST:
                var message = new DBML.message
                {
                    sender           = sender.id,
                    recipient        = recipientid,
                    title            = subject,
                    body             = "",
                    readStatus       = false,
                    senderDeleted    = false,
                    recipientDeleted = false,
                    created          = DateTime.UtcNow,
                    type             = MessageType.LINKREQUEST.ToString()
                };
                repository.AddMessage(message);
                break;

            default:
                break;
            }

            ////// send message
            var error = new ErrorData();

            if (controller != null)
            {
                body = controller.RenderViewToString(emailtype.ToDescriptionString(), viewData);
            }
            else
            {
                throw new NotImplementedException();
            }

            // wrap body with div to format it
            body = string.Concat("<div style=\"font: 12.5px/20px arial, sans-serif;\"", body, "</div>");

            // subject may contain HTML tags
            subject = subject.StripHtmlTags();

            switch (transportType)
            {
            case TransportType.EMAIL:
                Email.Email.SendMail(recipientname, destEmail, subject, body, sender, true);
                break;

            case TransportType.FACEBOOK:
                Syslog.Write("fbuser no email");
                error.success = false;
                error.message = "Facebook contact did not grant email permission";
                break;
            }
            return(error);
        }