Я запускаю 'curl' из приложения Lazarus / FPC, используя TProcess, например:
proc := TProcess.Create(nil);
proc.Executable:= 'E:\sendfileemail\curl.exe';
proc.CurrentDirectory:= 'E:\sendfileemail';
proc.Parameters.Add('--upload-file d:\29\ZP_1_2019.eml --url smtps://smtp.yandex.ru:465 --ssl-reqd --mail-from xxxx@yandex.ru --mail-rcpt yyyy@yandex.ru --user zzzz@yandex.ru:password --insecure');
proc.Options := proc.Options + [poWaitOnExit, poUsePipes, poStderrToOutPut];
proc.Execute;
AStringList := TStringList.Create;
AStringList.LoadFromStream(proc.Output);
AStringList.SaveToFile('output.txt');
AStringList.Free;
proc.Free;
Всегда происходит сбой с:
curl: option --upload-file d:\29\ZP_1_2019.eml: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
или любым параметром curl, который был первым.
Добавление каждого параметра отдельно с помощью «proc.Parameters.Add» не имеет значения.
В то же время
E:\sendfileemail\curl.exe --upload-file d:\29\ZP_1_2019.eml --url smtps://smtp.yandex.ru:465 --ssl-reqd --mail-from xxxx@yandex.ru --mail-rcpt yyyy@yandex.ru --user zzzz@yandex.ru:password --insecure
выполняется, как и ожидалось, из командной строки вручную.
ShellExecute также работает.
Что не так с запуском 'curl' через TProcess?