我使用以下代码从vmime发送邮件:
vmime::string urlString;
urlString="smtp://outgoing.verizon.net";
vmime::utility::url url(urlString);
vmime::ref <vmime::net::transport> tr =
g_session->getTransport(url,vmime::create <interactiveAuthenticator>());
// You can also set some properties (see example7 to know the properties
// available for each service). For example, for SMTP:
tr->setProperty("options.need-authentication", true);
tr->setProperty("auth.username", userName);
tr->setProperty("auth.password", password);
fromString=userName+"@verizon.net";
vmime::mailbox from(fromString);
vmime::mailboxList to;
toString = toUserName+"@verizon.net";
to.appendMailbox(vmime::create <vmime::mailbox>(toString));
std::ostringstream data;
data<<subjectId;
// Connect to server
tr->connect();
// Send the message
vmime::string msgData = data.str();
vmime::utility::inputStreamStringAdapter vis(msgData);
tr->send(from, to, vis, msgData.length());
logMsg(DEBUG,2,"Thread Id: %ld,Sent the data in the transaction",pthread_self());
我看到发送的数据在日志中是成功的。 但是,当我连接到[邮件发送到的邮箱]并检查收件箱时,我看到收件箱中有0封邮件。 vmime没有外观或错误。 当我连接到邮箱的网页版本。我无法看到任何交易被发送框,即使是成功的邮件。任何人都可以帮助我如何看到发送框中发送的邮件? 提前谢谢。
答案 0 :(得分:0)
使用任何嗅探器来捕获来自主机的SMTP流量。如果一切看起来都不错(即SMTP会话正确),那么这不是主机的问题,而是远程MTA(确保您的电子邮件未被检测为垃圾邮件等)