Hi! I'm writing one program for sending email. I saw some examples and took next code from one
QMessageService service;
bool b;
QString accountName
("111@gmail.com");
QMessage message;
message.setType(QMessage::Email);
message.setParentAccountId(QMessageAccountId(accountName));
QMessageAddress addr(QMessageAddress::Email,to);
message.setTo(addr);
message.setSubject(subject);
message.setBody(text);
b = message.parentAccountId().isValid();
if (service.send(message))
{
QMessageBox::information(0,tr
("Success"),tr
("Email sent successfully!"));
hide();
}
else
{
QMessageBox::warning(0, tr
("Failed"), tr
("Unable to send message. Valid: %1").
arg(b
));
}
QMessageService service;
bool b;
QString accountName("111@gmail.com");
QMessage message;
message.setType(QMessage::Email);
message.setParentAccountId(QMessageAccountId(accountName));
QString to("222@gmail.com");
QMessageAddress addr(QMessageAddress::Email,to);
message.setTo(addr);
QString subject("first message");
message.setSubject(subject);
QString text("Hello");
message.setBody(text);
b = message.parentAccountId().isValid();
if (service.send(message))
{
QMessageBox::information(0,tr("Success"),tr("Email sent successfully!"));
hide();
}
else
{
QMessageBox::warning(0, tr("Failed"), tr("Unable to send message. Valid: %1").arg(b));
}
To copy to clipboard, switch view to plain text mode
When i try to send message on my device it all the times say me "Unable to send message.Valid: 1". I don't know where can be mistake...should you give me any ideas?
Bookmarks