[fpc-pascal]connecting to mailserver

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Mon Jan 22 00:22:03 CET 2001


On Sun, 21 Jan 2001, Kenneth Due wrote:

> Has anyone tried to send a mail from within a fpc program
> 
> I'm trying to make a 'alarm program' to send a mail and/or a SMS via a
> smtpgateway
> 
> any simple solutions to this problem ?

On linux it's versy simple; one of the first examples:

-----------------------------------------------------------
program sendmail;

Uses linux;

var F : Text;

begin
  POpen(F,'sendmail me at myhost','W');
  Writeln(F,'Subject: Sending a mail with fpc');
  Writeln(F);
  Writeln(F,'sending mails is very easy');
  If PClose(F)=0 then 
    Writeln('Sent mail successfully')
end.
-----------------------------------------------------------

See linux unit documentation.

On windows, it's more hard, there you must use the 'mapi' dll;
but that is a little more complicated.

Michael.





More information about the fpc-pascal mailing list