2024年物联网嵌入式最新SMTP基本原理与C++实现向多人发送邮件_,smtp 命令行 多个发件人,2024年最新农民工看完都学会了

img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上物联网嵌入式知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

一下内容参考自 邮件正文及其附件的发送的C++实现,并添加了多个邮件接收者的功能

Smtp.h
#ifndef \_\_SMTP\_H\_\_ //避免重复包含
#define \_\_SMTP\_H\_\_

#include <list>
#include <WinSock2.h>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

const int MAXLEN = 1024;
const int MAX_FILE_LEN = 6000;

static const char base64Char[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

struct FILEINFO /\*用来记录文件的一些信息\*/
{
    char fileName[128]; /\*文件名称\*/
    char filePath[256]; /\*文件绝对路径\*/
};

class CSmtp
{
public:
    CSmtp(void);
    CSmtp(
        int port,
        std::string srvDomain,  //smtp服务器域名
        std::string userName,   //用户名
        std::string password,   //密码
        std::string targetEmail, //目的邮件地址
        std::string emailTitle,  //主题
        std::string content       //内容
        );
public:
    ~CSmtp(void);
public:
    int port;
public:
    std::string domain;
    std::string user;
    std::string pass;
    std::string targetAddr;
    std::string title;
    std::string content;
    /\*为了方便添加文件,删除文件神马的,使用list容器最为方便,相信大家在数据结构里面都学过\*/
    std::list <FILEINFO \*> listFile;

public:
    char buff[MAXLEN + 1];
    int buffLen;
    SOCKET sockClient;  //客户端的套接字
public:
    bool CreateConn(); /\*创建连接\*/

    bool Send(std::string &message);
    bool Recv();

    void FormatEmailHead(std::string &email);//格式化要发送的邮件头部
    int Login();
    bool SendEmailHead();       //发送邮件头部信息
    bool SendTextBody();        //发送文本信息
    //bool SendAttachment(); //发送附件
    int SendAttachment_Ex();
    bool SendEnd();
public:
    void AddAttachment(std::string &filePath); //添加附件
    void DeleteAttachment(std::string &filePath); //删除附件
    void DeleteAllAttachment(); //删除所有的附件

    void SetSrvDomain(std::string &domain);


**收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。**
![img](https://img-blog.csdnimg.cn/img_convert/8810ca90b434f0fd41826e023bff68c0.png)
![img](https://img-blog.csdnimg.cn/img_convert/1ddd2d5c3335dc64e23f468c8269744c.png)

**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618679757)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人**

**都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人**

**都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值