More compact than the last program that i proposed this on is the same.
It's true MIME::lite is more easer perhap's to prepare and send mail,but i not sure that it could control the return path for different adress between the person who send than personn who received crash information.
This program autorize this distinction between sender and crasher, and it could be important when the traitment of crash message must be done by automatic traitment. In few days , i will proposed to you this traitment.

Thanks to give me your observation.

2001-04-16 Edit by Corion : Changed title from "MORE COMPACT TO SEND EMAIL"

use IO::Socket; sub send_mail { my %value = @_ ; my %res = ( 'error' => '' , 'comment' => "Open Socket\n" , 'status' => 0 ) ; my @work = ( [ '' , '220' , 'Commun +ication with SMTP' ] , [ 'HELO robot<end>' , '250' , 'Hello +Serveur' ] , [ 'MAIL FROM: <insert:return-path><end>' , '250' , 'Insert + RETURN PATH adress' ] , [ 'RCPT TO: <insert:to><end>' , '250' , 'Insert + RECIENT adress' ] , [ 'DATA<end>' , '354' , 'Ask to + send DATA' ] , [ '<insert:message>' , '250' , 'Send D +ATA' ] , [ 'QUIT<end>' , '221' , 'Ask to + QUIT' ] ); $|=1; my $result = 0 ; my $reponse ; my $serveur = IO::Socket::INET->new( PeerAddr => $value{smtp +} , PeerPort => '25' , Proto => 'tcp' , Type => SOCK_STREAM , Timeout => 15 ) or return ( 'error' => "Error when open Socket -($!)-\n" , 'statut' => 0 , 'comment' => '' ); for (@work) { my @element = @$_ ; if ( $element[0] ne '' ) { $element[0] =~ s/<end>/\r\n/sgi; $element[0] =~ s/<insert:([^>]+?)>/$value{$1}/sgi ; print $serveur $element[0]; } $reponse = <$serveur>; if ($reponse =~ /^$element[1]/sgi) { $res{'comment'}.= $element[2]."\n"; } else { $res{error} = "error when $element[2] -($!)- " ; return %res ; } } $res{'statut'} = 1 ; return %res; } %test = ( 'return-path' => 'automatic_traitment@your_domain.com' , 'to' => 'my_friend@his_home.com' , 'smtp' => 'localhost' , 'message' => "To: Friend <my_friend@his_home.com> from: Me <my_own_adress@your_domain.com> Subject: Test on line TEST ON LINE . " ); send_mail ( %test ) ;

Replies are listed 'Best First'.
Re: MORE COMPACT TO SEND EMAIL
by lachoy (Parson) on Apr 16, 2001 at 06:51 UTC

    How is this possibly easier than using Mail::Send (using Mail::Header, also in the MailTools family) or Net::SMTP, both of which allow you to set your own headers? These modules have been tested in the real world by thousands of people in many different situations and environments, and I know have many other things to do -- like sleep :-) -- than reinvent a wheel that works really well already.

    Chris
    M-x auto-bs-mode

      Cause when you try to modify the return path you can't do it. The return path line is put by the the SMTP.
      Try and you will see !
        Not to denigrate your hard work, but why not subclass or extend an existing module to do what you want done differently? It sounds like there is only one major complaint you have with the existing code base-- which to me means that there is no reason to rebuild the whole thing unless adding that one feature is likely to severely break the existing module.