PDA

View Full Version : How to run a new e-mail message (ex. in outlook) with attach file



TomASS
29th October 2009, 11:32
Hello!

I'ld like to run (in QT command) a new e-mail message (ex.outlook) with a attach file from example C:\test\test.pdf. How can I do it?

1. how to run default e-mail klient?
2. how to add automaticly a attach file?

Big thanks!

squidge
29th October 2009, 12:03
Have you tried url handler with mailto: URL?

TomASS
29th October 2009, 12:19
Have you tried url handler with mailto: URL?

How can I attach the file?

I've:

QDesktopServices::openUrl(QUrl::QUrl("mailto:user@foo.com?subject=Test&body=Just a test&attach='c:\\tomek.txt'"));
and unfortunately isn't work :/

Any others ideas?

TomASS
29th October 2009, 21:13
On the other hand, when I'm trying lunch outlook.exe by:

QProcess* foo= new QProcess( this );
foo->setProcessChannelMode(QProcess::MergedChannels);
foo->setEnvironment( QProcess::systemEnvironment() );
foo->start( "outlook.exe" );

if( !foo->waitForFinished() ) {
qDebug() << QDir( foo->workingDirectory() ).entryList();
qDebug() << "Fail:" << foo->errorString();
qDebug() << "Exit = " << foo->exitCode();
} else {
qDebug() << "Output:" << foo->readAll();
}
I take a "Process failed to start" despite the fact that if i type "outlook.exe" in Stat->run it's working :/