Older/UnitTest/MailTest.cpp

25 lines
885 B
C++
Raw Normal View History

2024-12-24 23:46:20 +08:00
#include "BoostLog.h"
#include <Wt/Mail/Client.h>
#include <Wt/Mail/Mailbox.h>
#include <Wt/Mail/Message.h>
#include <boost/test/unit_test.hpp>
// BOOST_AUTO_TEST_CASE(MailTest) {
// Wt::Mail::Client client;
// client.enableAuthentication("17688947728@163.com", "yourpassword", Wt::Mail::AuthenticationMethod::Login);
// client.setTransportEncryption(Wt::Mail::TransportEncryption::TLS);
// LOG(info) << client.connect("smtp.163.com", 465);
// Wt::Mail::Mailbox from("17688947728@163.com");
// Wt::Mail::Mailbox to("168062547@qq.com");
// Wt::Mail::Message message;
// message.setFrom(from);
// message.addRecipient(Wt::Mail:: RecipientType::To,to);
// message.setReplyTo(to);
// message.setSubject(Wt::WString::fromUTF8("Hey there, \xe2\x82\xac !"));
// message.setBody("你好");
// LOG(info) << client.send(message);
// }