View Single Post
Old 04-25-2012, 04:26 AM   #5
woodx99
Junior Member
woodx99 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2012
Device: kindle touch
Blow is my full test source code:

Blow is my full test source code:

#include "stdafx.h"

#include "Windows.h"
#include "Winbase.h"


int main(int argc, char* argv[])
{
STARTUPINFO startinfo;
PROCESS_INFORMATION processinfo;
memset(&startinfo, 0, sizeof(STARTUPINFO));
startinfo.cb = sizeof(STARTUPINFO);
startinfo.lpReserved = NULL;
memset(&processinfo, 0, sizeof(PROCESS_INFORMATION));


const char* psExeName = "C:\\Program Files (x86)\\Calibre2\\calibre-smtp.exe";
char szCmdLine[4096];
strcpy(szCmdLine, "C:\\Program Files (x86)\\Calibre2\\calibre-smtp.exe -e SSL -r smtp.qq.com -u myuserid -p mypwd --port 465 -v -s \"Email_title\" from@qq.com to@foxmail.com \"mailBody\"");
const char* psCurrDir = "C:\\Program Files (x86)\\Calibre2";

if(CreateProcess(psExeName, szCmdLine, NULL, NULL, FALSE, CREATE_NO_WINDOW|DETACHED_PROCESS,
NULL, psCurrDir, &startinfo, &processinfo)==0)
{
printf("Create process failed.\n");
return -1;
}
printf("Create process ok.\n");

return 0;
}


==== This code can work, and print "Create process ok", but No mail has been sent.
woodx99 is offline   Reply With Quote