Hello, can you help me to send an email using LNET?
I want that my application make this automatically, without user intervention, with just one email and password defined in the source code.
I've tryed the code below but it did'nt work:
procedure TForm1.Button1Click(Sender: TObject);
var
Stream: TMimeStream;
begin
Stream := TMimeStream.Create;
Stream.AddFileSection('C:\DOCUME~1\Usuario\Desktop\log.txt');
Stream.Reset;
if not SMTP.Connected then SMTP.Connect('smtp.live.com', 25);
SMTP.StartTLS;
if SMTP.HasFeature('AUTH LOGIN') then // use login if possible
SMTP.AuthLogin('joaowiciuk@hotmail.com', '******')
else if SMTP.HasFeature('AUTH PLAIN') then // fall back to plain if possible
SMTP.AuthPlain('joaowiciuk@hotmail.com', '******');
//SMTP.SendMail(EditFrom.Text, EditTo.Text, EditSubject.Text, FMimeStream); -> send the stream
SMTP.SendMail('joaowiciuk@hotmail.com', 'joaowiciuk@hotmail.com', 'Teste', Stream); // send the stream
end;
It was based on a sample included with LNET 0.6.5, in which the user needs to manually configure a lot of things and click a few buttons and it works perfectly.
I think the problem is that my application code runs very quickly and no time to be established connections, authentication and TLS.
Here attached the original example, for analysis.