Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
# # EDVMAIL 0.2 # use warnings; use strict; use Mail::Sender; use File::Slurp; use Getopt::Attribute; use Getopt::ArgvFile; our $to : Getopt(an=s); our $from : Getopt(absender=s EDV); our $subject : Getopt(betreff=s); our $password : Getopt(passwort=s xxxx); our $mode : Getopt(modus=s html); our @cc : Getopt(cc=s); our @mailfiles : Getopt(dateien=s); our @attachments : Getopt(attachments=s); our @lines : Getopt(zeilen=s); die "Kein Adressat angegeben!\n" . usage() unless defined $to; die "Kein Betreff angegeben!\n" . usage() unless defined $subject; die "Keine Nachricht angegeben!\n" . usage() unless (@mailfiles or @lines); my ($br, $ctype); if ( $mode =~ /html/i ) { $br = "<br>"; $ctype = "text/html"; } else { $br = ""; $ctype = "text/plain"; } my $sender = new Mail::Sender { smtp => '192.168.1.23', from => "$from\@kvsaarland.de", authid => $from, authpwd => $password, } or die "Mail::Sender Objekt kann nicht erstellt werden: $Mail::Sender: +:Error\n"; $sender->OpenMultipart ({ to => $to, subject => $subject, cc => [@cc], boundary => "" }); $sender->Body({ encoding => 'ISO-8859-1', ctype=>$ctype }); $sender->Send('<font face="Arial" size="2">') if $br; if ( @lines ) { $sender->Send ( map { chomp; "$_$br\n" } @lines ) or die "$Mail::Sender::Error\n"; } if ( @mailfiles ) { $sender->Send ( map { map { chomp; "$_$br\n" } read_file ($_) } @m +ailfiles ) or die "$Mail::Sender::Error\n"; } $sender->Send('</font>') if $br; if ( @attachments ) { $sender->Send ( "$br\n" x 2 ), $sender->Attach ( { file => $_ } ) for @attachments; } $sender->Close() or die "Nachricht kann nicht gesendet werden: $sender->{'error_msg +'}\n"; print "Nachricht versendet.\n"; sub usage { return <<'USAGE'; edvmail.pl - 0.2 Aufruf: edvmail -parameter [wert] Parameter: -ab(sender) opt. Absender (ohne "@kvsaarland.de", default: EDV) -an erf. Empf„nger -cc * opt. Blindkopie -b(betreff) erf. Betreff -p(asswort) opt. Passwort, default "xxxx" -d(atei) * opt. Textdateien fr den Text der Mail -at(tachments) * opt. Anh„nge -z(eilen) * opt. Textzeilen -m(odus) opt. "text" or "html", default "html" Mit * gekennzeichnete Parameter können mehrfach angegeben werden. Beispiel: edvmail -ab m.holzer -an p.balfie@kvsaarland.de -cc m.taller@kvsaarla +nd.de -b "Na ihr Luschen?" -z "Was Lustiges" -z "im Anhang" -at c:\ +witze.txt USAGE }

In reply to flexible command line mail sender (SMTP) by holli

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-16 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found