### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Email sending  (Read 5787 times)

#### anis2505

• Full Member
• Posts: 201
##### Email sending
« on: December 17, 2012, 01:39:45 pm »
Hi,

I was thinking does anyone successfully managed to send an email via a lazarus application using Synapse LNet or anything else.
I've tried both and no chance.
If so please tell me how????

regards
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

#### BeniBela

• Hero Member
• Posts: 763
##### Re: Email sending
« Reply #1 on: December 17, 2012, 01:59:07 pm »
SendToEx does it very well.

Here is an old console program, where I use it:

Code: [Select]
sl: TStringList;
i: Integer;
begin
from := 'default sender @ somewhere';
for i:=1 to Paramcount do
if ParamStr(i) = '--from' then from := ParamStr(i+1)
else if ParamStr(i) = '--to' then receiver:= ParamStr(i+1)
else if ParamStr(i) = '--subject' then subject:= ParamStr(i+1);
sl:= TStringList.Create;
while not eof(Input) do begin
end;

end.

#### anis2505

• Full Member
• Posts: 201
##### Re: Email sending
« Reply #2 on: December 17, 2012, 02:18:08 pm »
SendToEx does it very well.

Here is an old console program, where I use it:

Code: [Select]
sl: TStringList;
i: Integer;
begin
from := 'default sender @ somewhere';
for i:=1 to Paramcount do
if ParamStr(i) = '--from' then from := ParamStr(i+1)
else if ParamStr(i) = '--to' then receiver:= ParamStr(i+1)
else if ParamStr(i) = '--subject' then subject:= ParamStr(i+1);
sl:= TStringList.Create;
while not eof(Input) do begin
end;

end.

Thanks.

A stupid question  . what library should I include to get SendToEx
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

#### theo

• Global Moderator
• Hero Member
• Posts: 1891
##### Re: Email sending
« Reply #3 on: December 17, 2012, 02:24:50 pm »
A stupid question  . what library should I include to get SendToEx

Unit smtpsend of Synapse

#### BigChimp

• Hero Member
• Posts: 5740
• Add to the wiki - it's free ;)
##### Re: Email sending
« Reply #4 on: December 17, 2012, 02:32:41 pm »
SendToEx does it very well.

Here is an old console program, where I use it:

Code: [Select]
sl: TStringList;
i: Integer;
begin
from := 'default sender @ somewhere';
for i:=1 to Paramcount do
if ParamStr(i) = '--from' then from := ParamStr(i+1)
else if ParamStr(i) = '--to' then receiver:= ParamStr(i+1)
else if ParamStr(i) = '--subject' then subject:= ParamStr(i+1);
sl:= TStringList.Create;
while not eof(Input) do begin
end;

end.
Thanks you guys, took the liberty of updating
http://wiki.lazarus.freepascal.org/Synapse#Sending_email

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

#### Ocye

• Hero Member
• Posts: 518
##### Re: Email sending
« Reply #5 on: December 18, 2012, 12:53:04 pm »
SendToEx does it very well.
SendToRaw() is even more simple (plain text email).

Code: [Select]
uses smtpsend (Synapse);

aSL:=TStringList.Create;
try