1

I want to send the email from my QTSimulator. I am using the following code for send the email.

    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.");

But I got the following error...
"Invalid message account ID
Failed to send message."

Please help me.. Thanks is advance.

Is it possible to send mail from QT-Simulator? Can we do any configuration for network connectivity?

laalto
  • 150,114
  • 66
  • 286
  • 303
Finder
  • 8,259
  • 8
  • 39
  • 54

2 Answers2

1

As far as I know this isn't possible. Qt simulator only has feature to simulate incoming messages so you can test how your app handles them.

Harmiih
  • 81
  • 1
  • 7
  • Thanks Harmith. Could you please tell me how to simulate incoming messages? is there any samples. Please assist me. – Finder Oct 23 '10 at 05:12
  • 1
    From Qt Simulator Control just expand messaging tab and there are two buttons for simulating incoming email and sms. – Harmiih Oct 25 '10 at 05:02
  • Thanks.. Can I check by device for receiving and sending the mail ? Is the code is correct ? Please assist me.. How to do it.. Thanks in advance – Finder Oct 25 '10 at 06:53
  • Have only done quick testing about sending sms with phone so really can't help with that one. Here is one example that helped me to get started with messaging api: http://doc.qt.nokia.com/qtmobility-1.0-beta/writemessage.html – Harmiih Oct 25 '10 at 09:03
0

Once I had qt mobility with messaging compiled on my own (under windows), so it was intergrated with ms outlook. Once email was received by Outlook, messaging sent notification. I guess this would work in an opposite direction. This worked in Qt Simulator as well (but button responsible for simulating new message was not working).