我想从QTSimulator发送电子邮件。我正在使用以下代码发送电子邮件。

    QMessage msg;
    msg.setType(QMessage::Email);

    // Set recipient for our email message
    QString recipient("xxxxx@gmail.com");
    msg.setTo(QMessageAddress(QMessageAddress::Email, recipient));

    // Define message subject, body and append attachment
    msg.setSubject("Messaging API example");
    msg.setBody("Hello,\n\nthis is an example message.");

    // Send message using a new service handle
    QMessageService* svc = new QMessageService();

    if (svc->send(msg))
        qDebug("Successfully sent message.");
    else
        qWarning("Failed to send message.");

但是我有以下错误...
“无效的消息帐户ID
无法发送消息。”

请帮我..谢谢您的进步。

是否可以从QT-Simulator发送邮件?我们可以为网络连接做任何配置吗?

有帮助吗?

解决方案

据我所知,这是不可能的。 QT Simulator仅具有模拟传入消息的功能,因此您可以测试应用程序如何处理它们。

其他提示

一旦我拥有QT移动性,并用自己的消息(在Windows下)编译了消息,因此它与MS Outlook相互融合。一旦通过Outlook收到电子邮件,消息传递已发送通知。我想这将朝着相反的方向起作用。这也可以在QT模拟器中工作(但是负责模拟新消息的按钮不起作用)。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top