tags:

views:

57

answers:

2

Hi,

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("[email protected]");
    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?

+1  A: 

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
Thanks Harmith. Could you please tell me how to simulate incoming messages? is there any samples. Please assist me.
Girija
From Qt Simulator Control just expand messaging tab and there are two buttons for simulating incoming email and sms.
Harmiih
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
Girija
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
A: 

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

Krzysztof