Esempio n. 1
0
 /// <summary>
 /// 初始化邮件账户数据
 /// </summary>
 /// <param name="key">KEY</param>
 /// <param name="data">EmailSmtpData</param>
 public static void Init(string key, EmailSmtpData data)
 {
     if (SmtpDict.ContainsKey(key))
     {
         SmtpDict[key] = data;
     }
     else
     {
         SmtpDict.Add(key, data);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 邮件发送
        /// </summary>
        /// <param name="key">KEY</param>
        /// <param name="subject">邮件主题</param>
        /// <param name="content">邮件内容</param>
        /// <param name="receiverList">收件人地址列表</param>
        /// <returns></returns>
        public static bool Send(string key, string subject, string content, string[] receiverList)
        {
            if (!SmtpDict.ContainsKey(key))
            {
                return(false);
            }

            EmailSmtpData smtpData = SmtpDict[key];

            return(Send(new EmailEntity()
            {
                Address = smtpData.Address,
                ReceiverList = receiverList.ToList <string>(),
                Subject = subject,
                Content = content,
                Account = smtpData.Account,
                Password = smtpData.Password,
                Smtp = smtpData.Smtp,
                Port = smtpData.Port,
                IsSsl = smtpData.IsSsl
            }));
        }