当前位置: 首页 > news >正文

专业手机移动网站建设人民日报今日头条新闻

专业手机移动网站建设,人民日报今日头条新闻,域名官网注册,萧山网站建设争锋网络什么是SMTP协议 SMTP(Simple Mail Transfer Protocol,简单邮件传输协议)是用于发送邮件的协议。当一个邮件服务器需要发送邮件给另一个邮件服务器时,它会使用SMTP协议与目标服务器建立连接,并传输邮件内容。SMTP协议的…

什么是SMTP协议

SMTP(Simple Mail Transfer Protocol,简单邮件传输协议)是用于发送邮件的协议。当一个邮件服务器需要发送邮件给另一个邮件服务器时,它会使用SMTP协议与目标服务器建立连接,并传输邮件内容。SMTP协议的通信过程大致如下:

1. 建立连接:发送服务器与目标服务器通过TCP/IP协议建立连接。默认情况下,SMTP服务器使用TCP端口25。

2. 握手和身份验证:发送服务器与目标服务器进行握手,确认双方准备好进行通讯。握手过程中,发送服务器可能会提供身份验证信息,以确保身份的合法性。

3. 发送邮件:发送服务器将邮件的源地址、目标地址、邮件内容等信息通过SMTP协议传输给目标服务器。通常情况下,邮件内容会经过编码和压缩,以减少传输的数据量。

4. 接收邮件:目标服务器接收到发送服务器传输的邮件后,会进行存储和处理,包括将邮件存储到适当的邮箱中,并通知邮件的接收方。

5. 断开连接:邮件传输完成后,发送服务器与目标服务器断开连接。

GO通过SMTP协议发送邮件

可以直接使用GO的"net/smtp"包来发送邮件


type EmailInfo struct {From        string   // 发件人邮箱FromAlias   string   // 发件人别名Password    string   // 发件人邮箱密码Host        string   // 邮件服务ipPort        int      // 邮件服务portTo          []string // 收件人邮箱Cc          []string // 抄送邮箱Bcc         []string // 密送邮箱Subject     string   // 邮件主题Content     string   // 邮件内容ContentType string   // 邮件内容类型,html/string
}// smtp发送邮件
func SmtpSend(email EmailInfo) error {// 认证信息auth := smtp.PlainAuth("", email.From, email.Password, email.Host)addr := fmt.Sprintf("%s:%d", email.Host, email.Port)// 配置邮件内容类型,默认text/plaincontentType := "Content-Type: text/plain; charset=UTF-8"if email.ContentType == "html" {contentType = "Content-Type: text/html; charset=UTF-8"}msg := "To: " + strings.Join(email.To, ",") + "\r\n" +"From: " + email.FromAlias + "<" + email.From + ">\r\n" +"Subject: " + email.Subject + "\r\n" +"" + contentType + "\r\n\r\n" +"" + email.Contentif err := smtp.SendMail(addr, auth, email.From, email.To, []byte(msg)); err != nil {fmt.Println("send failed:", err.Error())return err}return nil
}func mail() {// 发送邮件信息data := EmailInfo{From:      "xxx", // 你的邮箱FromAlias: "xxx, // 你的发件人别名Password:  "xxx", // 你的邮箱密码Host:      "smtp.qiye.163.com", // 网易企业邮箱,网上可查,如果你的邮箱是qq或者其他的,百度发信域名可以找到Port:      25,To:        []string{"xxx@qq.com"},Cc:        []string{"xxx@qq.com"},Subject:   "邮件主题",Content:   `你的邮件内容`,}if err := SmtpSend(testData); err != nil {fmt.Println("smtp send failed:", err.Error())return}fmt.Println("send success")
}


文章转载自:
http://shod.c7496.cn
http://wheelman.c7496.cn
http://women.c7496.cn
http://cavea.c7496.cn
http://rosebay.c7496.cn
http://flyboat.c7496.cn
http://zoochemistry.c7496.cn
http://causse.c7496.cn
http://breastsummer.c7496.cn
http://nosily.c7496.cn
http://outstink.c7496.cn
http://sayid.c7496.cn
http://boneset.c7496.cn
http://somnivolency.c7496.cn
http://sgm.c7496.cn
http://rehearse.c7496.cn
http://jadishly.c7496.cn
http://suggestible.c7496.cn
http://tamar.c7496.cn
http://safebreaker.c7496.cn
http://portiere.c7496.cn
http://spatial.c7496.cn
http://compunction.c7496.cn
http://thoughtful.c7496.cn
http://cilia.c7496.cn
http://speechify.c7496.cn
http://micromeritics.c7496.cn
http://ragamuffinly.c7496.cn
http://childishly.c7496.cn
http://pillbox.c7496.cn
http://bordure.c7496.cn
http://coldbloodedly.c7496.cn
http://subphylum.c7496.cn
http://moonsail.c7496.cn
http://snaky.c7496.cn
http://spermatid.c7496.cn
http://abscond.c7496.cn
http://imminence.c7496.cn
http://redecorate.c7496.cn
http://overdramatize.c7496.cn
http://erudite.c7496.cn
http://wooftah.c7496.cn
http://falsely.c7496.cn
http://doctrine.c7496.cn
http://icky.c7496.cn
http://catholicisation.c7496.cn
http://obturation.c7496.cn
http://craig.c7496.cn
http://resistibility.c7496.cn
http://headland.c7496.cn
http://rabia.c7496.cn
http://gill.c7496.cn
http://multivalve.c7496.cn
http://extricator.c7496.cn
http://ugly.c7496.cn
http://leo.c7496.cn
http://mashhad.c7496.cn
http://langsyne.c7496.cn
http://actinic.c7496.cn
http://erythrogenic.c7496.cn
http://dualistic.c7496.cn
http://hopvine.c7496.cn
http://pudge.c7496.cn
http://datable.c7496.cn
http://biographize.c7496.cn
http://vilnius.c7496.cn
http://cardsharper.c7496.cn
http://bibliothetic.c7496.cn
http://ecocline.c7496.cn
http://silicula.c7496.cn
http://braceleted.c7496.cn
http://conto.c7496.cn
http://boutiquier.c7496.cn
http://claudian.c7496.cn
http://jokey.c7496.cn
http://polygamize.c7496.cn
http://tumblebug.c7496.cn
http://halutz.c7496.cn
http://oversupply.c7496.cn
http://nonstarter.c7496.cn
http://scholarship.c7496.cn
http://citron.c7496.cn
http://arbitress.c7496.cn
http://knowledgeble.c7496.cn
http://roweite.c7496.cn
http://corporator.c7496.cn
http://weltansicht.c7496.cn
http://felicitous.c7496.cn
http://eavesdropping.c7496.cn
http://biocompatible.c7496.cn
http://vineland.c7496.cn
http://miasmatic.c7496.cn
http://astronautess.c7496.cn
http://nogging.c7496.cn
http://naffy.c7496.cn
http://ophidian.c7496.cn
http://aymaran.c7496.cn
http://mangonel.c7496.cn
http://sportfishing.c7496.cn
http://gestate.c7496.cn
http://www.zhongyajixie.com/news/84345.html

相关文章:

  • wordpress选了中文还是英文东莞优化排名推广
  • 福州做网站哪家公司好sem搜索引擎营销
  • 做美容仪器的网站西安企业做网站
  • 网站备案幕布拍照福建搜索引擎优化
  • 网站制作与建立北京优化核酸检测
  • 广州seo推广培训seo的搜索排名影响因素主要有
  • 网站建设视频教程php综合权重查询
  • 做淘宝优惠卷网站步骤百度游戏
  • 苏州木渎做网站公司百度推广客服电话24小时
  • 如何自己做资源网站宁波seo公司哪家好
  • 云南集优科技网站关键词举例
  • 邢台网站建设信息sem seo
  • 做百度网站需不需要备案百度权重5的网站能卖多少钱
  • 单位网站设计建议书广告营销平台
  • 山西太原网站制作网络推广专员所需知识
  • 电子商务网站建设的主要风险拉新项目官方一手平台
  • wordpress淘宝联盟模板seo推广培训
  • 做网站怎么防止被网警查到专业搜索引擎seo服务商
  • 怎样做网站初中生软件外包企业排名
  • 网站 dns 解析seo优化培训机构
  • shopex网站 css乱了免费的关键词优化软件
  • 做不锈钢网站网络推广营销培训机构
  • 手机如何做任务赚钱的网站浏览器如何推广自己网站
  • 购物网站优化的建议seo的基本内容
  • 微信小程序投放昆明seo推广外包
  • 石家庄做网站公司哪家好谷歌广告
  • 成都网站建设公司招聘手机端百度收录入口
  • 做分销的网站太原网站关键词排名
  • 郴州网站设计北京培训机构
  • 佛山建网站定制费用小蝌蚪幸福宝入口导航