Title: send a quick e-mail
Question: Send a quick e-mail
Answer:
Use IdSMTP from INDY clients
IdSMTP1.QuickSend('host','topic','From','to','Text');
you can't send attatchments with this code but it works perfectly with text....
another solution than can work is:
program Konsole_Mailsender;
{$APPTYPE CONSOLE}
uses
SysUtils,
IDSMTP,
IDMESSAGE;
var
manda: TIdSMTP;
messa: TIdMessage;
text: TIdText;
begin
manda:= TIdSMTP.Create(nil);
messa:= TIdMessage.Create(nil);
messa.Clear;
messa.ContentType:='';
text := TIdText.Create(nil);
text.Body.Add('Hello... this is a test...');
messa.From.Address := 'yo@MyMail.com';
messa.Sender.Address:= 'yo@MyMail.com';
messa.Recipients.Clear;
with messa.Recipients.Add do Address := 'SomeOne@MyMail.com';//this is the the recipient address..
TIdAttachment.Create(messa.MessageParts,'z:\MyAttatchment.zip');//attatchment
manda.Host := '192.168.1.1';
manda.Port := 25;
try
try
manda.Connect;
manda.Send(messa);
except
on e: Exception do
writeln(e.message);
end;
finally
manda.Disconnect;
end;
end.
I implements this in console....
I'm not sure if it works...
greetings!!!!