1.1 阿里云企业云邮箱管理
step 1:登录阿里云控制台
step 2:搜索 “邮箱”
step 3:用管理员邮箱登录
step 4:新建员工邮箱
邮箱访问地址: https://qiye.aliyun.com 登录邮箱分配账号
1.2 阿里云企业邮箱免费版新注册地址
https://wanwang.aliyun.com/mail/freemail/
阿里云企业云邮箱参数配置及邮件发送代码
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace Common.Messages
{
public class EmailSender
{
/// <summary>
/// 调试成功
/// </summary>
/// <param name="toEmail"></param>
/// <param name="subject"></param>
/// <param name="body"></param>
/// <returns></returns>
public async Task SendEmailAsync(string toEmail, string subject, string body)
{
string result;
using (var smtpClient = new SmtpClient())
{
//发送方式
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
//smtp服务器
smtpClient.Host = "smtp.mxhichina.com";
//设置发送时间间隔
// smtpClient.Timeout = m_timeout;
smtpClient.UseDefaultCredentials = true;
//用户名凭证
smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "12345");
//邮件信息
MailMessage message = new MailMessage();
//发件人
message.From = new MailAddress("[email protected]");
//收件人
//foreach (object item in MailTo)
//{
// message.To.Add(item.ToString());
//}
message.To.Add(toEmail);
message.To.Add("[email protected]");
//主题
message.Subject = subject;
//内容
message.Body = body;
//正文编码
message.BodyEncoding = System.Text.Encoding.Default;
//设置为HTML格式
message.IsBodyHtml = true;
//优先级
message.Priority = MailPriority.High;
//smtpClient.Send(message);//同步发送方式
await smtpClient.SendMailAsync(message);//异步发送方式
}
}
}
}
发送代码
Common.Messages.EmailSender d = new Common.Messages.EmailSender();
await d.SendEmailAsync("2*[email protected]", "dd", "dd");
腾讯企业邮箱
在appsettings.json配置收发邮件的账号等信息。
//appsettings.json
"Email": {
"Host": "smtp.exmail.qq.com",
"Port": 465,
"UseSsl": true,
"From": {
"Username": "[email protected]",
"Password": "[Password]",
"Name": "MEOWV.COM",
"Address": "[email protected]"
},
"To": [
{
"Name": "test1",
"Address": "[email protected]"
},
{
"Name": "test2",
"Address": "[email protected]"
}
]
}
阿里云企业代收邮箱设置
企业云邮箱各个服务器地址及端口信息如下:
收件服务器地址:
POP 服务器地址:pop.qiye.aliyun.com 端口110,SSL 加密端口995
或
IMAP 服务器地址:imap.qiye.aliyun.com 端口143,SSL 加密端口993
发件服务器地址:
SMTP 服务器地址:smtp.qiye.aliyun.com 端口25, SSL 加密端口465
189.cn foxmail 邮箱设置
foxmail 配置:
邮箱类型:imap
收件服务器地址:[email protected]
IMAP 服务器地址:imap.189.cn 端口143
发件服务器地址:
SMTP 服务器地址:smtp.189.cn 端口25