Mail-Sender-0.8.16/ 40777 0 0 0 11036735243 6731 5Mail-Sender-0.8.16/Changes100666 0 0 13723 11036735230 10263 Revision history for Perl extension Mail::Sender. I am sorry I did not keep track of the changes :-( Version 0.4 : I added several methods for most common tasks. MailMsg : Send a string as a mail by single call MailFile : The same plus attached files SendFile : Insert a file as a part of a multipart message Send(Line)Enc : Automatic encoding (Base64,Quoted-Printable) Version 0.5 : Cancel : cancel an Opened message. $sender->{'error'} : last error for this object. @Errors : a list of error messages. Several minor fixes. Version 0.6 : fixed problems with Base64 encoding. Files are now read, encoded and sent in parts instead of whole at once. You may call SendEnc several times in one part now. ... Version 0.6.6 : Added support for CC: and BCC:. Version 0.6.9b : 7/19/1999 - BETA Open(), MailMsg and MailFile accept ctype, and encoding parameters. You have more options in Part() and Body(). It's possible to send HTML mails with inlined images easily now. Error -5 (Unspecified communication error) now includes the actual error returned by the mail server. Some more examples in the docs. Mail::Sender now tries to guess the content type for attached files. You may now create not only multipart/mixed but also multipart/related or other messages. Version 0.7.00 Mail/Sender.config file may be used to set up default options for new Mail::Sender. You may install a function that gets called for every message. Version 0.7.01 - 12/9/1999 bugfix (qmail would not accept attachments) Version 0.7.02 - 8/1/19100 bugfix Don't tell me I'm stuuupid, I know it. Ever tried to send en email with a line consisting of only a single dot? Version 0.7.03 - 14/1/19100 bugfix Don't tell me I'm stuuupid, I know it. As Jan Starzynski pointed out it ate the last character on each line in SendEx() (Used in SendFile) under Unix. Oh well :-( Version 0.7.04 - 8/1/19100 bugfix A fix only in the configuration script because of some unimportant problems with PPM instalation. No change to the module itself. Version 0.7.05 - 25/1/19100 Added fake_from, fake_to and fake_cc options to new/Open/OpenMultipart/MailMsg/MailFile. This allows you to send a message to a list of people, while including only the list name/address in the headers. The fake_... may be whatever text you like, doesn't need to look like an address. Version 0.7.06 bugfix Version 0.7.07 - 4/4/2001 bugfix Fixed a stupid bug related to multipart messages (have you ever used one hash item for two different purposes? I AM that stupid!) Version 0.7.08 - 4/10/2001 doc fix Version 0.7.09 - 6/28/2001 minor fixes Version 0.7.10 minor instalation related fixes Version 0.7.11 not public, beta only Version 0.7.12 - 2/18/2002 added debuging output The problem with multiline responses from some SMTP servers (namely qmail) is solved. Version 0.7.13 - 3/13/2002 made compatible with Perl 5.004 again (sorry I don't have 5.004 at hand and noone reported the problems before releasing 0.7.12 to general public) Improved compatibility with some BSD versions (using sockaddr_in() instead of pack()) Version 0.7.13.1 - 3/17/2002 very small and very important fix. Don't tell me I'm stupid. I know it. Pleae don't use 0.7.12 and 0.7.13 Version 0.7.13.2-5 internal only, BETA versions. Please do not use. Version 0.7.14 - 6/6/2002 added ESMTP authentication (LOGIN, PLAIN, CRAM-MD5) docs tuneup various small fixes Version 0.8.00 Version 0.8.01 internal only, please do not use fixed problems with PerlIO and ascii-mode sockets under windows with Perl 5.8 Version 0.8.03 - 12/29/2002 - added NTLM authentication - send_cmd (internal function for sending commands to the server) checks for broken connections - reverted the server response tests (instead of /^[45]/ (server reported an error) I use now !/^[123]/ (server reported success) ) - some documentation fixes and additions Version 0.8.04 - 01/08/2003 - fixed typo causing the "Unknown PerlIO layer 'raw:perlio' at .../Mail/Sender.pm line 21" - fixed incorrect handling of halfhour timezones Version 0.8.05 - 03/01/2003 - new Mail::Sender ({..., die_on_errors => 1}); Version 0.8.06 - 03/24/2003 - new Mail::Sender ({..., on_errors => 'die'}); - new Mail::Sender ({..., on_errors => 'undef'}); - new Mail::Sender ({..., on_errors => 'code'}); - A small fix for an issue with nested parts on the courier-imap server (whatever it is). Version 0.8.08 - fixed an error in SendEx() causing problems with qmail (thanks to report&help from "Luciano Bueno " ) - added debugging levels - added an option that tells Mail::Sender to ignore rejected recipients - you can now overwrite the message-id generation function - added two addins improving the content type guesswork - added TestServer method/function - improved handling of the last newline in quoted-printable encoded parts (the Outlook problem with = appearing at the end of attached files) Version 0.8.09 - private Version 0.8.10 - use $ENV{HOSTNAME} || $ENV{HTTP_HOST} in preference to (gethostbyname 'localhost')[0] as the local name if none is specified by the user - fixed half-hour timezone handling - fixed to => [list, of, addresses] handling - fixed "incorrect server name" handling (previous versions did not report the problem correctly in all cases - untaining the IP address of the SMTP server in all cases - fixed a problem that caused rare doubling of dots in quoted-printable encoded parts. - various doc improvements Version 0.8.11 - private Version 0.8.13 - 02/25/2006 - fixed incorrect handling of singlequotes in mail addresses - add SMTP commands now sent in uppercase - removing the port number if the local name is taken from $ENV{HTTP_HOST} - improved getting the current user name - can accept authid and authpwd already encoded to base64 - better handling of errors when reading attachments from files and when opening the debug files - fixed some problems in Content-type header generation Mail-Sender-0.8.16/Config.PL100666 0 0 17534 11036735230 10436 # Never modify Config.PPM, always Config.PL # (Whenever you generate a distribution Config.PPM is overwriten by Config.PL) # just to tell make we are done with configuring open CFG, '>Config';print CFG "\n";close CFG; use Cwd; use FileHandle; use Socket; print "\n\n ################# Default new object settings for Mail::Sender ################# \n"; sub Ignore { print "\nDo you want to change the setting or use this one in spite of the errors?\n\t(C)hange / (U)se : "; local $_; while () { return 1 if /^u$/i; return if /^c$/i; print "\t(C)hange / (U)se : "; } exit; } if ($0 =~ /\.PPM$/i) { print "Running from PPM...\n\n"; chdir '..'; # find Mail/Sender.pm foreach $dir (@INC) { if (-e $dir.'/Mail/Sender.pm') { $configfile = $dir.'/Mail/Sender.config'; last; } } unless ($configfile) { print STDERR "The module Sender.pm is not found. Are you realy running the script via PPM install ???\n"; ; exit(1); } if (-e $configfile) { print "You have already specified some defaults for Mail::Sender, They are saved in $configfile. If you go on you will OVERWRITE the whole file! You'd better edit the file by hand.\n"; $new=' new and OVERWRITE old'; } } else { # called directly die "Do not execute this script directly, run:\n\tperl Makefile.PL \tmake\n\tmake test\n\tmake install\n If you are using ActivePerl under Windows use 'nmake' instead of 'make'. nmake.exe may be found at ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe\n" unless -d 'blib/lib/Mail'; { my $dir; foreach $dir (@INC) { if (-e $dir.'/Mail/Sender.config') { print "You have already specified some defaults for Mail::Sender, They are saved in $dir/Mail/Sender.config. If you go on you will OVERWRITE the whole file! You'd better edit the file by hand.\n"; $new=' new and OVERWRITE old'; last; } } } } print "\nSpecify$new defaults for Mail::Sender? (y/N) "; $res = ; exit unless $res =~ /^y$/i; if (! $configfile) { print "\n\t... will be saved to .../lib/Mail/Sender.config\n"; $configfile = 'blib/lib/Mail/Sender.config'; } else { print "\n\t... will be saved to $configfile\n"; } while (1) { print "\nDefault SMTP server (hostname or IP address)\n\n\t: "; $smtp=;chomp $smtp; last unless $smtp; print "\n\t...Trying $smtp..."; my $proto = (getprotobyname('tcp'))[2]; my $port = getservbyname('smtp', 'tcp'); $smtp =~ s/^\s+//g; # remove spaces around $smtp $smtp =~ s/\s+$//g; my $smtpaddr = inet_aton($smtp); unless ($smtpaddr) { print "FAILED\n\t...cannot find server '$smtp' !!!\n"; if (Ignore()) {last} else {next}; next; } my $s = &FileHandle::new(FileHandle); if (!socket($s, AF_INET, SOCK_STREAM, $proto)) { die <<"*END*"; Call to socket() failed. You either do not have enough permissions or something really strange happened. Until you fix this neither Mail::Sender nor any other network related module will work. :-(( *END* if (Ignore()) {last} else {next}; } if (!connect($s, sockaddr_in($port, $smtpaddr))) { print "FAILED\n\t...the server is either down or doesn't accept connections\n\ton port 25(SMTP)."; if (Ignore()) {last} else {next}; } my($oldfh) = select($s); $| = 1; select($oldfh); $_ = <$s>; if (/^[45]\d*\s*(.*)$/) { close $s; print "FAILED\n\t...the server replied '$1'.\n"; if (Ignore()) {last} else {next}; } print $s "helo localhost\r\n"; $_ = <$s>; if (/^[45]\d*\s*(.*)$/) { close $s; print <<"*END*"; To my greeting the server replied '$1'. It probably meens that you will have to specify the client name when connecting to this server. You should specify the default client name later during this configuration, otherwise you will have to include parameter client=> in every "new Mail::Sender" call. *END* if (Ignore()) {last} else {next}; } print $s "quit\r\n"; print "successful :-)\n"; last; } $default{smtp} = "'$smtp'"; print <<"*END*"; ********************************************************************* **** ALL of the following Defaults are interpreted as perl code ***** ********************************************************************* ********************************************************************* Default FROM value (must be perl code / ENTER for none): \tExamples: \t * 'user\@yourdomain.com' \t * getlogin() . '\@yourdomain.com' \t * 'Your Name '\n *END* print "\t: "; $default{from}=; for ($default{from}) { chomp; $_ = "'$_'" if /^[\w\d.-]+@(?:[\w\d-]+\.)*[\w\d]+$/; } delete $default{from} unless $default{from}; print "\n*********************************************************************\n"; print "Default for REPLY-TO field (must be perl code / ENTER for none):\n\n\t: "; $default{replyto}=; for ($default{replyto}) { chomp; $_ = "'$_'" if /^[\w\d.-]+@(?:[\w\d-]+\.)*[\w\d]+$/; } delete $default{replyto} unless $default{replyto}; print "\n*********************************************************************\n"; print "Default for CC field (must be perl code / ENTER for none):\n\n\t: "; $default{cc}=; for ($default{cc}) { chomp; $_ = "'$_'" if /^[\w\d.-]+@(?:[\w\d-]+\.)*[\w\d]+$/; } delete $default{cc} unless $default{cc}; print "\n*********************************************************************\n"; print "Default for BCC field (must be perl code / ENTER for none):\n\n\t: "; $default{bcc}=; for ($default{bcc}) { chomp; $_ = "'$_'" if /^[\w\d.-]+@(?:[\w\d-]+\.)*[\w\d]+$/; } delete $default{bcc} unless $default{bcc}; print "\n*********************************************************************\n"; print "Default name of the client MACHINE used when connecting\nto the SMTP server (must be perl code / ENTER for none):\n\n\t: "; $default{client}=; chomp $default{client};delete $default{client} unless $default{client}; print "\n*********************************************************************\n"; print "Default additional headers (must be perl code / ENTER for none):\n\n\t: "; $default{headers}=; chomp $default{headers};delete $default{headers} unless $default{headers}; print "\n*********************************************************************\n"; print "Default encoding of message bodies (N)one, (Q)uoted-printable, (B)ase64:\n\n\t: "; while () { chomp; /^q$/i and $default{encoding} = "'Quoted-printable'" and last; /^b$/i and $default{encoding} = "'Base64'" and last; (/^n$/i or /^$/) and last; } print "\n*********************************************************************\n"; print "Default charset of message bodies (must be perl code / ENTER for none):\n\n\t: "; $default{charset}=; chomp $default{charset}; unless ($default{charset}) { delete $default{charset} } else { $default{charset} =~ /^[\w\d_-]+$/ and $default{charset} = "'$default{charset}'"; } print "\n*********************************************************************\n"; print "*********************************************************************\n"; #sleep 20; open CFG, '>'.$configfile; select CFG; print "### Config file for Mail::Sender\n### generated by Config.PL (".scalar(localtime).")\n\n"; print "%default = (\n"; foreach (keys %default) { print "\t$_ => $default{$_},\n"; } print ");\n\n"; print <<'*END*'; # The contents of this variable will be inserted into the headers of every # mail message sent by Mail::Sender. # # $Mail::Sender::SITE_HEADERS = "X-Sender: ".getlogin()."\@mysite.com"; # This function will be evaluated for every mail message before contacting the server. # You may change all the options of the message and even cancel the message. # # sub SiteHook { # } 1; *END* select STDOUT; close CFG; print "The defaults were saved into $configfile Please review the code in there if 'make test' or every 'use Mail::Sender;' command fails."; 1; Mail-Sender-0.8.16/Makefile.PL100666 0 0 1040 11036735230 10707 use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. #system(($^O eq 'VMS' ? 'mcr ': ()),$^X, 'Config.PL'); WriteMakefile( 'NAME' => 'Mail::Sender', 'PREREQ_PM' => {'MIME::Base64' => 0}, 'VERSION_FROM' => 'Sender.pm', # finds $VERSION ($] ge '5.005') ? ( 'AUTHOR' => 'Jan Krynicky (Jenda@Krynicky.cz)', 'ABSTRACT' => 'Send mails with attachments through a SMTP server, socket()s based.', 'LICENSE' => 'Perl' ) : (), ); Mail-Sender-0.8.16/MANIFEST100666 0 0 322 11036735230 10050 Changes Makefile.PL Config.PL MANIFEST README Sender.pm t/00-load.t t/01-create-object.t Sender/CType/Ext.pm Sender/CType/Win32.pm META.yml Module meta-data (added by MakeMaker) Mail-Sender-0.8.16/META.yml100666 0 0 744 11036735243 10204 --- #YAML:1.0 name: Mail-Sender version: 0.8.16 abstract: Send mails with attachments through a SMTP server, socket()s based. license: Perl generated_by: ExtUtils::MakeMaker version 6.3201 distribution_type: module requires: MIME::Base64: 0 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 author: - Jan Krynicky (Jenda@Krynicky.cz) Mail-Sender-0.8.16/README100666 0 0 1625 7760211454 7614 Mail::Sender - module for sending mails with attachments through an SMTP server Version 0.8.10 by Jenda@Krynicky.cz http://Jenda.Krynicky.cz Highlights: Since version 0.7.14 allows ESMTP authentication. Protocols builtin to Sender.pm : LOGIN, PLAIN, CRAM-MD5, NTLM You can add new supported protocols easily. Known problems : The problem with multiline responses from some SMTP servers (namely qmail) is solved. Future plans: I would like to rewrite the module completely to clean up the code and add better error handling. During that I'll add also timeouts and stuff. I don't know when will I have time to do that :-( Copyright (c) 1997-2003 Jan Krynicky . All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself with only one exception, you are not allowed to use the module for SPAM. Mail-Sender-0.8.16/Sender/ 40777 0 0 0 11036735242 10150 5Mail-Sender-0.8.16/Sender/CType/ 40777 0 0 0 11036735242 11174 5Mail-Sender-0.8.16/Sender/CType/Ext.pm100666 0 0 14314 7720134450 12311 package Mail::Sender; %Mail::Sender::CTypes = ( #------------------------------------------ 'HTML', "text/html", 'HTM', "text/html", 'STM', "text/html", 'SHTML', "text/html", 'TXT', "text/plain", 'PREF', "text/plain", 'AIS', "text/plain", 'RTX', "text/richtext", 'TSV', "text/tab-separated-values", 'NFO', "text/warez-info", 'ETX', "text/x-setext", 'SGML', "text/x-sgml", 'SGM', "text/x-sgml", 'TALK', "text/x-speech", 'CGI', "text/plain", # we want these two as text files 'PL', "text/plain", # and not application/x-httpd-cgi #----------------------------------------- 'COD', "image/cis-cod", 'FID', "image/fif", 'GIF', "image/gif", 'ICO', "image/ico", 'IEF', "image/ief", 'JPEG', "image/jpeg", 'JPG', "image/jpeg", 'JPE', "image/jpeg", 'PNG', "image/png", 'TIF', "image/tiff", 'TIFF', "image/tiff", 'MCF', "image/vasa", 'RAS', "image/x-cmu-raster", 'CMX', "image/x-cmx", 'PCD', "image/x-photo-cd", 'PNM', "image/x-portable-anymap", 'PBM', "image/x-portable-bitmap", 'PGM', "image/x-portable-graymap", 'PPM', "image/x-portable-pixmap", 'RGB', "image/x-rgb", 'XBM', "image/x-xbitmap", 'XPM', "image/x-xpixmap", 'XWD', "image/x-xwindowdump", #------------------------------------------ 'EXE', "application/octet-stream", 'BIN', "application/octet-stream", 'DMS', "application/octet-stream", 'LHA', "application/octet-stream", 'CLASS', "application/octet-stream", 'DLL', "application/octet-stream", 'AAM', "application/x-authorware-map", 'AAS', "application/x-authorware-seg", 'AAB', "application/x-authorware-bin", 'VMD', "application/vocaltec-media-desc", 'VMF', "application/vocaltec-media-file", 'ASD', "application/astound", 'ASN', "application/astound", 'DWG', "application/autocad", 'DSP', "application/dsptype", 'DFX', "application/dsptype", 'EVY', "application/envoy", 'SPL', "application/futuresplash", 'IMD', "application/immedia", 'HQX', "application/mac-binhex40", 'CPT', "application/mac-compactpro", 'DOC', "application/msword", 'ODA', "application/oda", 'PDF', "application/pdf", 'AI', "application/postscript", 'EPS', "application/postscript", 'PS', "application/postscript", 'PPT', "application/powerpoint", 'RTF', "application/rtf", 'APM', "application/studiom", 'XAR', "application/vnd.xara", 'ANO', "application/x-annotator", 'ASP', "application/x-asap", 'CHAT', "application/x-chat", 'BCPIO', "application/x-bcpio", 'VCD', "application/x-cdlink", 'TGZ', "application/x-compressed", 'Z', "application/x-compress", 'CPIO', "application/x-cpio", 'PUZ', "application/x-crossword", 'CSH', "application/x-csh", 'DCR', "application/x-director", 'DIR', "application/x-director", 'DXR', "application/x-director", 'FGD', "application/x-director", 'DVI', "application/x-dvi", 'LIC', "application/x-enterlicense", 'EPB', "application/x-epublisher", 'FAXMGR', "application/x-fax-manager", 'FAXMGRJOB', "application/x-fax-manager-job", 'FM', "application/x-framemaker", 'FRAME', "application/x-framemaker", 'FRM', "application/x-framemaker", 'MAKER', "application/x-framemaker", 'GTAR', "application/x-gtar", 'GZ', "application/x-gzip", 'HDF', "application/x-hdf", 'INS', "application/x-insight", 'INSIGHT', "application/x-insight", 'INST', "application/x-install", 'IV', "application/x-inventor", 'JS', "application/x-javascript", 'SKP', "application/x-koan", 'SKD', "application/x-koan", 'SKT', "application/x-koan", 'SKM', "application/x-koan", 'LATEX', "application/x-latex", 'LICMGR', "application/x-licensemgr", 'MAIL', "application/x-mailfolder", 'MIF', "application/x-mailfolder", 'NC', "application/x-netcdf", 'CDF', "application/x-netcdf", 'SDS', "application/x-onlive", 'SGI-LPR', "application/x-sgi-lpr", 'SH', "application/x-sh", 'SHAR', "application/x-shar", 'SWF', "application/x-shockwave-flash", 'SPRITE', "application/x-sprite", 'SPR', "application/x-sprite", 'SIT', "application/x-stuffit", 'SV4CPIO', "application/x-sv4cpio", 'SV4CRC', "application/x-sv4crc", 'TAR', "application/x-tar", 'TARDIST', "application/x-tardist", 'TCL', "application/x-tcl", 'TEX', "application/x-tex", 'TEXINFO', "application/x-texinfo", 'TEXI', "application/x-texinfo", 'T', "application/x-troff", 'TR', "application/x-troff", 'TROFF', "application/x-troff", 'MAN', "application/x-troff-man", 'ME', "application/x-troff-me", 'MS', "application/x-troff-ms", 'TVM', "application/x-tvml", 'TVM', "application/x-tvml", 'USTAR', "application/x-ustar", 'SRC', "application/x-wais-source", 'WKZ', "application/x-wingz", 'ZIP', "application/x-zip-compressed", 'ZTARDIST', "application/x-ztardist", #-------------------------------------