On Wed, 21 Jul 2004, Ron Hunter-Duvar wrote:

> Anyone out there ever written a script to send email messages?
>
> I want to write a script that will send a message to a certain email address
> when called. I thought I could just use the "mail" program, but it relies
> on /usr/sbin/sendmail to actually send the message. I believe that means I
> have to install and configure either sendmail or postfix. Sounds like a lot
> of work for a simple script.
>
> I don't want to run my own mail server (not at the moment). I rely on my isp
> for sending and receiving email.
>
> Is there a simple way to do this? Can I somehow tell kmail to do it for me? If
> not, can someone point me to some good instructions for configuring postfix
> to do what I need without interfering with email to/from my isp, and without
> opening up security holes in my system (e.g. an open relay).
>

Might want to look at smtp-source?  Not sure if it is what you are looking
for - but the MAN page looked slightly promising.

Also, If you are using perl check out
http://search.cpan.org/~gbarr/libnet-1.19/Net/SMTP.pm which says:

This example sends a small message to the postmaster at the SMTP server
known as mailhost:

    #!/usr/local/bin/perl -w

    use Net::SMTP;

    $smtp = Net::SMTP->new('mailhost');

    $smtp->mail($ENV{USER});
    $smtp->to('postmaster');

    $smtp->data();
    $smtp->datasend("To: postmaster\n");
    $smtp->datasend("\n");
    $smtp->datasend("A simple test message\n");
    $smtp->dataend();

    $smtp->quit;

Hope that helps.

Job

____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to