[Gambas-user] Sendmail tool and Gambas2

Benoit Minisini gambas at ...1...
Thu Jul 17 02:20:34 CEST 2008


On mardi 15 juillet 2008, Nx GT-R BOY wrote:
> Hi, As part of my development in Gambas2 I am making a feature in my
> software that remains people a to-do list daily via email.
>
> So far I am working with sendmail, but If you know a better alternative
> would be appreciated.
>
> At shell I do:
> sendmail some at ...1939...
> From: some2 at ...1939...
> Subject: To-do list remind
> Remember to pickup some things at 2:00pm
> CTRL+D
>
> I cant find a way to use sendmail in a single line, I think must be all in
> different lines, so, How do I execute this from gambas (different lines?)?,
> Do you think that write in real time a script and then call it from gambas
> could be the best (optimum?) option?
>
> And the most important thing, How do I send a CTRL+D to the shell, without
> it, the mail wont be send.
>
> Thanks in advance.

First, run sendmail from your program:

hProcess = SHELL "sendmail" FOR INPUT OUTPUT

Then, to send something to sendmail, just PRINT to it:

PRINT #hProcess, "First Line"
PRINT #hProcess, "Second Line"
...

To send what is usually named "CTRL+D", just close the stream.

CLOSE #hProcess

Regards,

-- 
Benoit Minisini




More information about the User mailing list