📄 testsmailer.cpp
字号:
///////////////////////////////////////////////////////////////////
// This program is a demostration about how to use SMailer.
// Written by Morning, mailto:moyingzz@etang.com
//
// Date:2003-5
///////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <list>
#include <string>
#include <iostream>
#include "SMailer/SMailer.h"
#include "MUtils/WinSockHelper.h"
void main()
{
MUtils::WinSockHelper wshelper;
// make sure the file 'boot.ini' is in the root directory on driver C
SMailer::TextPlainContent content1("plain text content");
SMailer::TextHtmlContent content2("<a href='http://www.vcsoft.org/bbs'>click me</a>");
SMailer::AppOctStrmContent content3("c:\\boot.ini");
SMailer::AppOctStrmContent content4("c:\\1.bmp");
// SMailer::AppOctStrmContent content3("c:\\README.txt");
SMailer::MailInfo info;
info.setSenderName("www.vcsoft.org/bbs");
//??下面请填写您的邮件地址比如XX@163.com
info.setSenderAddress("XX@163.com");
info.addReceiver("XX", "XX@163.com");
// info.addReceiver("friend2", "zhuwangis@163.com");
info.setPriority(SMailer::Priority::normal);
info.setSubject("a test mail");
info.addMimeContent(&content1);
info.addMimeContent(&content2);
info.addMimeContent(&content3);
info.addMimeContent(&content4);
try
{
// 请正确设置下面的信息,跟FOXMAIL设置的一样即可
SMailer::MailSender sender("smtp.163.com", "你的用户名(@前面的部分)", "你的密码");
sender.setMail(&SMailer::MailWrapper(&info));
sender.sendMail();
}
catch (SMailer::MailException& e)
{
std::cout << e.what() << std::endl;
}
catch (...)
{
std::cout << "Unkown error" << std::endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -