开发者

Send a mail with Qt & php.exe

I have a problem with a program which I'm creating for my job. It's a C++ program which is developing with Qt.

I want to send an email, so I call php in C++:

QStringList l;
QString    msg(mail.c_str());
l << "C: //sql.php"; //my function which send an email
l << msg; // my email
this->_php->start("C:\\Program Files\\wamp\\bin\\php\\php5.3.8\\php.exe", l);

This code is working and php is not writing an error. So look my other function in php (myemail@xxx.fr is not m开发者_如何学编程y real adress :p, I have hiding it for asking my question)

    $headers = 'From: "xxx"<noreply@xxx.fr>' . "\n";
$headers .='Content-Type: text/html; charset="iso-8859-1"' . "\n";
$headers .='Content-Transfer-Encoding: 8bit' . "\n";

$obj = "my_object";
$msg = "<html><head></head><body>awdadwawdawd</body></html>";
if (mail("myemail@xxx.fr", $obj, $msg, $headers) == true)
    echo "ok";
else
    echo "fail";

So this is working because "ok" was print on my C++ program. But this email wasn't arrived on my e-mail box. When I try to launch the php's function in wamp (with localhost....) it's working because I received this mail. But when i try with my C++ program and php.exe, e-mails didn't arrived.

Someone have and idea or a suggestion to fix my problem?


It seems like config problem. Check your php.ini and specially SMTP settings.

php -i | findstr SMTP //check SMTP server
php -i | findstr "Configuration File" //to check php.ini location
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜