php获取outlook邮件内容,php Mail()和Outlook

我有以下代码:

$subject = "Test Email";

$from = "noreply@bob.com";

ini_set("sendmail_from", $from);

$message = "

Hello

This is a test email.


Click Here


Thank you for your time,

";

$headers = "MIME-Version: 1.0\r\n";

$headers .= "Content-type: text/html\r\n";

$headers .= "From: " . $from . "\r\n";

mail($mail, $subject, $message, $headers);

但是,当我向自己发送电子邮件时,我会在Outlook中看到所有代码.如果我将其发送给其他人,他们会看到HTML.如果我将它发送到我的hotmail,他们会看到HTML.

这是我的展望(2007)的问题,如果是,它是什么,或者我可以在电子邮件中做些什么来保证它正确显示?

请帮忙!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以使用Qt的ActiveQt模块来调用COM组件,并使用Outlook Object Model来获取指定用户的邮件内容。以下是一个简单的示例代码,演示如何使用Qt和Outlook Object Model来获取指定用户的收件箱邮件内容: ```cpp #include <QCoreApplication> #include <QAxObject> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); // 创建Outlook.Application对象 QAxObject outlook("Outlook.Application"); // 获取指定用户的收件箱对象 QAxObject *namespaceObj = outlook.querySubObject("GetNamespace(const QString&)", "MAPI"); QAxObject *recipientObj = namespaceObj->querySubObject("CreateRecipient(const QString&)", "user@example.com"); QAxObject *recipientResolvedObj = recipientObj->querySubObject("Resolve()"); QAxObject *inboxObj = namespaceObj->querySubObject("GetDefaultFolder(int)", 6); // 6代表收件箱 QAxObject *userInboxObj = inboxObj->querySubObject("GetSharedDefaultFolder(QVariant&)", recipientResolvedObj->asVariant()); // 获取收件箱中的邮件数量 int count = userInboxObj->dynamicCall("Items").property("Count").toInt(); // 遍历收件箱中的邮件 for(int i = 1; i <= count; i++) { QAxObject *mailObj = userInboxObj->querySubObject("Items").querySubObject("Item(int)", i); // 获取邮件主题和内容 QString subject = mailObj->dynamicCall("Subject").toString(); QString body = mailObj->dynamicCall("Body").toString(); qDebug() << "Subject:" << subject; qDebug() << "Body:" << body; mailObj->dynamicCall("Release()"); } userInboxObj->dynamicCall("Release()"); inboxObj->dynamicCall("Release()"); recipientResolvedObj->dynamicCall("Release()"); recipientObj->dynamicCall("Release()"); namespaceObj->dynamicCall("Release()"); outlook.dynamicCall("Release()"); return a.exec(); } ``` 请将代码中的"MAPI"和"user@example.com"替换为您实际使用的值。此外,代码中也可以根据需要修改获取邮件属性,例如获取发件人、收件人、发送时间等等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值