Suresh Ramasubramanian wrote:

>>moreover this one gives you the option of queuing the emails not just
>>sending them immediately (if you are knowledgeable enough to configure
>>sendmail).
>>
>
>So you say that if you submit anything using Net::SMTP to localhost, it won't
>queue mail (if sendmail is configured to queue mail when offline)?
>
>       -srs
>  
>

Sorry, no hard feelings. OK well, I didn't mean it is not possible, 
instead of writing the whole mail sending function, i thought may be it 
will be easier to do this way in  minutes, if you know how to fiddle 
with your config file, well you have your ride.

If you want it here are the functions that I use to spam the people.

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#!! Do error check if you want to
#!!

sub sendMail
{
    my($fromUser, $destinations, $message) = @_;
    my($error);

    # This is not really appropriate for an argument, I think.
    my($server) = ("localhost");
    my($fromDomain) = ("whatever.net");

        #########################################
    # Establish a connection to the specified
    # SMTP server.  Note that this also specifies
    # the domain from which we are connecting.
    #
    my($smtp);
    if ($fromDomain =~ /^\s*$/)
    {
        $smtp = Net::SMTP->new($server);
    }
    else
    {
        $smtp = Net::SMTP->new($server, Hello=>$fromDomain);

    }

    if (!defined($smtp))
    {
        $error = "VirtualMail: Unable to connect to server \"$server\"";
        return($error);
    }

    #$smtp->debug(1);

    $smtp->mail($fromUser);

    # Indicate destination(s)
    my($destination);

    for $destination (@$destinations)
    {
        $smtp->recipient($destination);
    }

    $smtp->data();              # Start the message itself

    ########################################
    # Message Body Stuff
    #
    $smtp->datasend($message);
    $smtp->dataend();               # End message

    if (!$smtp->quit())
    {
        $error = "Unable to send the message to server $server";
    }

    return($error);
}




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to