I've written a little ruby script that lets me send emails by calling it along with some command line parameters.
At the command line, this works:
ruby.exe mail_it.rb fromaddr="[email protected]" tolist="[email protected]"
But try as I may, I can't get it to work in Delphi 2007 for Win32. Here's the latest attempt:
procedure TForm1.Button1Click(Sender: TObject);
var
params: string;
begin
params:= 'mail_it.rb fromaddr="[email protected]" tolist="[email protected]"';
caption:= IntToStr(ShellExecute(Form1.Handle, nil, PChar('ruby.exe'), PChar(params), nil, SW_SHOW));
end;
I've tried using 'open' as the second param in ShellExecute, but it doesn't help. ShellExecute itself returns 42, which as far as I can tell from what I've found on other websites means "no error".