示例#1
0
        public static string Send(string subject, string body, string to, string cc, string from)
        {
            string adminMain = WebConfigurationManager.AppSettings["MailAdmin"];
            string message   = "";

            if ("".Equals(from))
            {
                from = adminMain;
            }

            DaoResult daoResult = DaoHelper.Create("[dbo].[SP_Send_Mail] @profile_name,  @program_key,  @recipients,  @copy_recipients, " +
                                                   " @blind_copy_recipients, @subject,  @body, @body_format, @importance, @sensitive, @from")
                                  .AddParameter("@profile_name", "Hunter Alert") // DB發信的設定名稱
                                  .AddParameter("@program_key", "Hunter_Models_Mail_Send")
                                  .AddParameter("@recipients", to)               // 收件者
                                  .AddParameter("@copy_recipients", cc)          // CC
                                  .AddParameter("@blind_copy_recipients", "")    // 密件副本
                                  .AddParameter("@subject", subject)             //
                                  .AddParameter("@body", body)
                                  .AddParameter("@body_format", "HTML")
                                  .AddParameter("@importance", "NORMAL")
                                  .AddParameter("@sensitive", "NORMAL")
                                  .AddParameter("@from", from) // from
                                  .SetConnection("KWSEAI")
                                  .ExecuteUpdate();

            if (!daoResult.IsSuccess)
            {
                message = daoResult.Message;
            }
            return(message);
        }