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

沈阳做网站的地方网站设计欣赏中国

沈阳做网站的地方,网站设计欣赏中国,怎样把自己的产品放到网上销售,cms 网站后台内容管理系统模板实验目的 运用各种编程语言实现基于 smtp 协议的 Email 客户端软件。 实验内容 1. 选择合适的编程语言编程实现基于 smtp 协议的 Email 客户端软件。 2. 安装 Email 服务器或选择已有的 Email 服务器#xff0c;验证自己的 Email 客户端软件是否能进行正常的 Email 收发功…实验目的 运用各种编程语言实现基于 smtp 协议的 Email 客户端软件。 实验内容 1. 选择合适的编程语言编程实现基于 smtp 协议的 Email 客户端软件。 2. 安装 Email 服务器或选择已有的 Email 服务器验证自己的 Email 客户端软件是否能进行正常的 Email 收发功能。 实验过程 使用学校地的SMTP服务器做发送这里操作比较简单无需授权码直接使用账号密码登录即可 编写基于smtp的邮件发送客户端这里调用了Curl库来实现这个库支持多种通信协议 编写基于pop3的邮件接收客户端在查询相关资料后pop3相较于smtp更常用于邮件接收此处选择pop3来实现更贴近实际情况 关键代码讲解 smtp邮件发送客户端主要邮件发送函数使用了 libcurl 库。首先初始化一个 CURL 句柄然后设置 SMTP 服务器的地址、发送者的电子邮件地址和密码。接着函数设置邮件的接收者构造邮件的内容。函数调用 curl_easy_perform 函数来发送邮件如果发送失败会打印出错误信息。最后函数清理并释放所有使用过的资源。 void sendEmail( const std::string smtpServer, const std::string from, const std::vectorstd::string to, const std::string password, const std::string subject, const std::string body ) { CURL *curl; CURLcode res CURLE_OK; struct curl_slist *recipients NULL; curl curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_USERNAME, from.c_str()); curl_easy_setopt(curl, CURLOPT_PASSWORD, password.c_str()); curl_easy_setopt(curl, CURLOPT_URL, smtpServer.c_str()); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from.c_str()); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); for(const auto recipient : to) { recipients curl_slist_append(recipients, recipient.c_str()); } curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); std::string email To: to[0] \r\n From: from \r\n Subject: subject \r\n\r\n body; curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, email); res curl_easy_perform(curl); if(res ! CURLE_OK) std::cerr curl_easy_perform() failed: curl_easy_strerror(res) std::endl; curl_slist_free_all(recipients); curl_easy_cleanup(curl); } } pop3邮件接收客户端也是使用libcurl的库进行连接接收用户名和密码通过pop3方式登录返回邮件列表 void receiveEmail(const std::string pop3Server, const std::string username, const std::string password) {CURL *curl;CURLcode res CURLE_OK;curl curl_easy_init();if(curl) {curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);curl_easy_setopt(curl, CURLOPT_USERNAME, username.c_str());curl_easy_setopt(curl, CURLOPT_PASSWORD, password.c_str());curl_easy_setopt(curl, CURLOPT_URL, pop3Server.c_str());curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);std::string response;curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);curl_easy_setopt(curl, CURLOPT_WRITEDATA, response);res curl_easy_perform(curl);if(res ! CURLE_OK)std::cerr curl_easy_perform() failed: curl_easy_strerror(res) std::endl;elsestd::cout response std::endl;curl_easy_cleanup(curl);} }运行示例 编译运行smtp邮件客户端发送邮件 用户输入信息发送方邮箱地址/发送方邮箱授权码/接收方邮箱地址/邮件主题/邮件内容显示发送过程中的日志信息 邮件接受效果此处示例为群发两封邮件 POP3客户端接收邮件用户输入信息登录然后列出所有的邮件 相关代码 BJTU_CS_Learning/computernetwork at main · JJLi0427/BJTU_CS_Learning (github.com)
http://www.hkea.cn/news/14448596/

相关文章:

  • 购买网站建设合同协议模板菏泽建设
  • 潮州住房和城乡建设局网站专业国外网站建设
  • 传奇网站模板使用怎么用手机黑网站
  • 建筑资质证书查询网站软件下载页面制作
  • 网站的推广策略搜索软件使用排名
  • 低价刷粉网站推广wp网站打开太慢怎么做优化
  • 深圳住房和建设局网站在哪个网南京网络建站模板
  • 网站建设与管理方案的总结wordpress 中英文双语
  • asp网站的安全性拍拍网的网站建设
  • 网站百度收录秒收方法小众设计公司logo
  • wordpress修改地址后网站打不开免费邯郸网站建设
  • 网站建设技术及服务承诺智能小区物业管理系统
  • 邹城网站建设公司用手机搭建自己的网站
  • 网站建站麻烦吗软装设计师需要具备的能力
  • 在哪里创建网站平台个人微信小程序怎么赚钱
  • 建设公司网站报价wordpress卢松松评论模板
  • 注册一个网站seo搜索引擎工具
  • 温州市瓯海建设局网站嘉兴市住房和城乡建设局门户网站
  • php网站源码个人简历word模板
  • 安顺网站开发安保企业网站模板
  • 街舞舞团公司做网站域名查询系统
  • 驾校门户网站模板产品营销软文
  • 广东网站定制wordpress 换主题问题
  • 北京建设教育协会官方网站网页制作基础教程第二版教材
  • 深圳建网站哪个公司好网站小样用什么做
  • 网站上有什么作用贵州省城乡建设部官方网站
  • 优酷wordpress建站教程软件设计师证书有用吗
  • 吴镇宇做的电影教学网站自己做的网页加在网站文章上为什么打不开
  • 网站开发方向c语言世界工厂网网页版
  • 邯郸网站建设策划方案对外网站ipv6建设方案模板