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 ) ;

In reply to More compact to send email by iguane

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.