my Lazarus compiler 2.0.0. Yes, Yes... I know it is sooooo old that I shouldn't use this version at all... lol... but it is working and compiling my code with NO ISSUES whatsoever. If I were to upgrade, it will break over 50% of all my components and LIBRARIES that means many of my codes/program will seize to compile forever. Just thought I'd let you all know, before you all jump on me for this... lol...
Anyways, I am trying to use the msmtp terminal command to send email messages. I have searched online for this command and found a lot of good information and samples. So, I was able to come up with a command line that works flawlessly. It sends email and I can even send SMS text message to smartphone. ONLY through TERMINAL or CONSOLE.
echo "Hello world" | msmtp --from=James@James.com 1234567899@tmomail.net
However, this same commandline code WILL NOT execute from within Lazarus. No message box pops up or gives any hints or errors. I don't get SMS or EMAIL message either. The function is below.
function SendMail:Boolean;
var
sp:TProcess;
L:Tstringlist;
begin
l:=tstringlist.create;
sp:= Tprocess.Create(nil);
try
sp.options:=[poUsePipes];
sp.executable := 'echo';
sp.Parameters.Add('"Hello World"');
sp.Parameters.Add('|');
sp.Parameters.Add('msmpt --from=james@james.com 1234567899@tmomail.net');
sp.execute;
l.SaveToStream(sp.Input);
l.clear;
l.LoadfromStream(sp.output);
writeln(l.text);
finally
sp.free;
l.free;
end;
result:=true;
end;
Can someone tell me what is wrong with the above PASCAL CODE?