0

我使用以下代码从 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 没有异常或错误。当我连接到邮箱的网络版时。我无法看到任何已发送的交易,即使是成功的邮件也是如此。谁能帮助我如何查看已发送邮箱中发送的邮件?提前致谢。

4

1 回答 1

0

使用任何嗅探器来捕获来自主机的 SMTP 流量。如果一切看起来都不错(即 SMTP 会话正确),那么这不是您的主机的问题,而是远程 MTA(确保您的电子邮件未被检测为垃圾邮件等)

于 2013-01-22T10:54:10.240 回答