[fpc-pascal]Free Pascal librares for e-mail

Arne Hanssen nite at c2i.net
Sun May 19 17:26:32 CEST 2002


On Fri, 17 May 2002 20:00:56 +0300, Cyril Zlachevsky wrote:
>  John Coppens wrote:
> > Hi Cyril,
> > 
> > I think the easiest way to send e-mail, is to directly call the unix sendmail program
> > through an exec call. On one line you can include destination address, subject
> > and body. Or you can prepare a simple file with the message data inside, and
> > then call sendmail with exec.
>   .
>  [mazay at warp tesing]$ cat mailproc.pp
>  uses dos;
>  begin
>     Exec('/usr/sbin/sendmail.postfix','-U mazay at phone.dn.ua < 111.tmp');
>  end.
> > 
> > On Fri, 17 May 2002 17:37:59 +0300 (EEST)
> > Cyril Zlachevsky <mazay at phone.dn.ua> wrote:
> > 
> > 
> >>I need send e-mail messages from pascal program (in linux).
> >>But can't find any procedure or funtion for mailing in Free Pascal.
> >>
> >>How I can solve my problem in fpc for linux?
 
I believe you are looking for the POpen procedure.  Regrettably I do
not have my code at hand, but as far as I remember you can do some-
thing like:

var
  fd: text;
begin
  POpen(fd, '/bin/mail user at sub.net', 'W');
  writeln(fd,"Subject: Test");
  {... other mailheaders/contents ...}
  PClose( fd );
end;

Check the docs - there may be an (working) example.

-- 
Vennlig hilsen / Best regards
Arne Hanssen





More information about the fpc-pascal mailing list