comp.lang.ada
 help / color / mirror / Atom feed
* Re: Looking for package Email
  2001-06-18 15:08 Looking for package Email M. A. Alves
@ 2001-06-18 13:17 ` Gerhard Häring
  2001-06-18 15:01 ` Mark Johnson
  2001-06-19  8:45 ` Ken Thomas
  2 siblings, 0 replies; 6+ messages in thread
From: Gerhard Häring @ 2001-06-18 13:17 UTC (permalink / raw)


On Mon, 18 Jun 2001 16:08:02 +0100 (WEST), M. A. Alves <maa@liacc.up.pt> wrote:
>I want to send email messages from an Ada program.  Any package out
>there?  Suggestions?  Thanks.

pyAda (http://pyada.sf.net) contains an example that makes Python's smtplib
library available as Ada objects and methods.

If you have any comments on pyAda, I'd like to hear.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://highqualdev.com              public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Looking for package Email
  2001-06-18 15:08 Looking for package Email M. A. Alves
  2001-06-18 13:17 ` Gerhard Häring
@ 2001-06-18 15:01 ` Mark Johnson
  2001-06-18 16:34   ` Samuel Tardieu
  2001-06-18 16:44   ` M. A. Alves
  2001-06-19  8:45 ` Ken Thomas
  2 siblings, 2 replies; 6+ messages in thread
From: Mark Johnson @ 2001-06-18 15:01 UTC (permalink / raw)


"M. A. Alves" wrote:

> I want to send email messages from an Ada program.  Any package out
> there?  Suggestions?  Thanks.
>
> --
>    ,
>  M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
>  A M A D O   Rua Campo Alegre, 823         fax 351+226003654
>  A L V E S   P-4150 PORTO, Portugal        mob 351+939354002

Hmm. I believe the short answer is "maybe", but I am not sure. I could
answer this at several levels...

[1] On many systems, generate your mail message as a text file & use an
OS call to run your mail utility program to send it.

[2] Use a package such as...
>
http://www.informatik.uni-stuttgart.de/ifi/ps/AdaBasis/pal_1195/ada/asr/ddn/smtp/

(assuming you have the other prerequisites - such as a server that
accepts SMTP)

[3] Hook into another email interface - varies by system.

What kind of system do you want run this Ada based "send email" from?
  --Mark




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Looking for package Email
@ 2001-06-18 15:08 M. A. Alves
  2001-06-18 13:17 ` Gerhard Häring
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: M. A. Alves @ 2001-06-18 15:08 UTC (permalink / raw)
  To: comp.lang.ada

I want to send email messages from an Ada program.  Any package out
there?  Suggestions?  Thanks.

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150 PORTO, Portugal        mob 351+939354002




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Looking for package Email
  2001-06-18 15:01 ` Mark Johnson
@ 2001-06-18 16:34   ` Samuel Tardieu
  2001-06-18 16:44   ` M. A. Alves
  1 sibling, 0 replies; 6+ messages in thread
From: Samuel Tardieu @ 2001-06-18 16:34 UTC (permalink / raw)
  To: comp.lang.ada

>>>>> "Mark" == Mark Johnson <mark_h_johnson@raytheon.com> writes:

Mark> "M. A. Alves" wrote:
>> I want to send email messages from an Ada program.  Any package out
>> there?  Suggestions?  Thanks.

Mark> Hmm. I believe the short answer is "maybe", but I am not sure. I
Mark> could answer this at several levels...

There is also Pascal Obry's SMTP package at

  http://perso.wanadoo.fr/pascal.obry/contrib.html

 Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Looking for package Email
  2001-06-18 15:01 ` Mark Johnson
  2001-06-18 16:34   ` Samuel Tardieu
@ 2001-06-18 16:44   ` M. A. Alves
  1 sibling, 0 replies; 6+ messages in thread
From: M. A. Alves @ 2001-06-18 16:44 UTC (permalink / raw)
  To: comp.lang.ada

> [1] On many systems, generate your mail message as a text file & use an
> OS call to run your mail utility program to send it.

Doing that now.  Using the "mail" utility on a Linux system, in a call to
the POSIX "system" function.  Simplest way, I think.  It works---as long
as the system settings associated with the "mail" utility are ok of
course.

package Mail is

  Error: exception;

  procedure Send_Message(
    To: String;
    CC: String := "";
    BC: String := "";
    Reply_To: String := "";
    Subject: String := "";
    Text: String := "");

end Mail;

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_Io; use Ada.Text_Io;
with Posix; use Posix;

package body Mail is

  procedure Send_Message(
    To: String;
    CC: String := "";
    BC: String := "";
    Reply_To: String := "";
    Subject: String := "";
    Text: String := "")
  is
    Tempfilename: String := "/tmp/a_temporary_mail_message_text_file";
    Tempfile: File_Type;
    U: Unbounded_String;
    R: Integer;
  begin
    Create(Tempfile, Out_File, Tempfilename);
    Put(Tempfile, Text);
    Append(U, "mail");
    if CC /= "" then
      Append(U, " -c" & CC);
    end if;
    if BC /= "" then
      Append(U, " -b" & BC);
    end if;
    if Subject /= "" then
      Append(U, " -s """ & Subject & """");
    end if;
    Append(U, " " & To & " < " & Tempfilename);
    R := System(To_String(U));
    Delete(Tempfile);
    if R = 127 or R = -1 then raise Error; end if;
  end Send_Message;

end Mail;

package Posix is

  function System(Command: String) return Integer;

end Posix;

with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;

package body Posix is

  function C_System(Command: chars_ptr) return int;
  pragma Import(C, C_System, "system");

  function System(Command: String) return Integer is
    C_Command : aliased char_array := To_C(Command);
  begin
    return(Integer(C_System(To_Chars_Ptr(C_Command'Unrestricted_Access))));
  end System;

end Posix;

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150 PORTO, Portugal        mob 351+939354002




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Looking for package Email
  2001-06-18 15:08 Looking for package Email M. A. Alves
  2001-06-18 13:17 ` Gerhard Häring
  2001-06-18 15:01 ` Mark Johnson
@ 2001-06-19  8:45 ` Ken Thomas
  2 siblings, 0 replies; 6+ messages in thread
From: Ken Thomas @ 2001-06-19  8:45 UTC (permalink / raw)


Look at Pascal Obry's package STMP.
http://perso.wanadoo.fr/pascal.obry/contrib.html

Ken Thomas
"M. A. Alves" <maa@liacc.up.pt> wrote in message
news:mailman.992873360.13616.comp.lang.ada@ada.eu.org...
> I want to send email messages from an Ada program.  Any package out
> there?  Suggestions?  Thanks.
>
> --
>    ,
>  M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
>  A M A D O   Rua Campo Alegre, 823         fax 351+226003654
>  A L V E S   P-4150 PORTO, Portugal        mob 351+939354002
>





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-06-19  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 15:08 Looking for package Email M. A. Alves
2001-06-18 13:17 ` Gerhard Häring
2001-06-18 15:01 ` Mark Johnson
2001-06-18 16:34   ` Samuel Tardieu
2001-06-18 16:44   ` M. A. Alves
2001-06-19  8:45 ` Ken Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox