1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
QAxWidget outlook;
if(outlook.setControl( "Outlook.Application" )){
qDebug() << "Success to get Outlook application";
QAxObject *mail = outlook.querySubObject("CreateItem(olMailItem)");
if(mail){
mail->setProperty("To","email@address.com");
mail->setProperty("Subject","test automation");
mail->setProperty("Body", "Hello, this is the mail body.\n Goodbye");
QAxObject *attachments = mail->querySubObject("Attachments");
if(attachments){
attachments->dynamicCall("Add(\"C:/temp/TestDump.html\")");
} else{
qDebug() << "Failed to get \"Attachments\" object. Attachments have not been added";
}
mail->dynamicCall("Display()");
mail->dynamicCall("Send()");
mail->deleteLater();
} else{
qDebug() << "Failed to create mail item";
}
} else{
qDebug() << "failed to get oultook application";
} |
Partager