Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mail-Sender CPAN distribution.

Report information
The Basics
Id: 53021
Status: resolved
Priority: 0/
Queue: Mail-Sender

People
Owner: Nobody in particular
Requestors: bwagner [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.8.16
Fixed in: (no value)



Subject: use LWP::MediaTypes instead of GuessCType (with patch)
If you used: use LWP::MediaTypes qw(guess_media_type); you could replace: use vars qw(%CTypes); %CTypes = ( GIF => 'image/gif', JPE => 'image/jpeg', JPEG => 'image/jpeg', SHTML => 'text/html', SHTM => 'text/html', HTML => 'text/html', HTM => 'text/html', TXT => 'text/plain', INI => 'text/plain', DOC => 'application/x-msword', EML => 'message/rfc822', ); sub GuessCType { my $ext = shift; $ext =~ s/^.*\.//; return $CTypes{uc $ext} || 'application/octet-stream'; } by: sub GuessCType { guess_media_type($_[0]); } And you would immediately support more file types.
Subject: Sender.patch
--- Sender.pm.orig 2009-12-24 00:44:19.000000000 +0100 +++ /opt/local/lib/perl5/site_perl/5.8.9/Mail/Sender.pm 2009-12-24 00:38:53.000000000 +0100 @@ -6,6 +6,7 @@ package Mail::Sender; local $^W; require 'Exporter.pm'; +use LWP::MediaTypes qw(guess_media_type); use vars qw(@ISA @EXPORT @EXPORT_OK); @ISA = (Exporter); @EXPORT = qw(); @@ -941,25 +942,8 @@ return $self; } -use vars qw(%CTypes); -%CTypes = ( - GIF => 'image/gif', - JPE => 'image/jpeg', - JPEG => 'image/jpeg', - SHTML => 'text/html', - SHTM => 'text/html', - HTML => 'text/html', - HTM => 'text/html', - TXT => 'text/plain', - INI => 'text/plain', - DOC => 'application/x-msword', - EML => 'message/rfc822', -); - sub GuessCType { - my $ext = shift; - $ext =~ s/^.*\.//; - return $CTypes{uc $ext} || 'application/octet-stream'; + guess_media_type($_[0]); } sub Connect {
As of 0.8.22 may be "installed" by adding use Mail::Sender::CType::LWP; into the script or into .../Mail/Sender.config