Exemplo n.º 1
0
        /// <summary>
        /// 执行测试
        /// </summary>
        public override void ExecuteTest()
        {
            ModServerInfo sendInfo = new ModServerInfo()
            {
                SmtpHost  = "smtp.host.com",
                SmtpPort  = 9696,
                SmtpUser  = "******",
                SmtpPwd   = "password",
                EnableSsl = true,
            };

            ModEmailInfo emailInfo = new ModEmailInfo()
            {
                FromEmail = "*****@*****.**",
                ToEmail   = new List <string> {
                    "*****@*****.**"
                },
                AttachmentList = new List <Attachment>()
                {
                    new Attachment(@"X:\FilePath")
                },
            };

            bool result = sendInfo.CF_SendEmail(emailInfo, out string errMsg);

            if (result)
            {
                PrintLogLn(MsgType.Success, "邮件发送成功!");
            }
            else
            {
                PrintLogLn(MsgType.Error, $"邮件发送失败: {errMsg}");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 发送邮件
 /// </summary>
 /// <param name="sendInfo">发送信息</param>
 /// <param name="emailInfo">邮件信息</param>
 /// <param name="errMsg">[OUT]错误信息</param>
 /// <returns>执行结果</returns>
 public static bool CF_SendEmail(this ModServerInfo sendInfo, ModEmailInfo emailInfo, out string errMsg)
 {
     return(EmailOperate.CF_SendEmail(sendInfo, emailInfo, out errMsg));
 }