Subject: | TR: New version of Net-SMTP-Multipart 1.5.4 |
Date: | Thu, 16 Nov 2006 18:47:53 +0100 |
To: | <bug-Net-SMTP-Multipart [...] rt.cpan.org> |
From: | "GUENNEGUEZ T ROSI/DOSI" <thomas.guenneguez [...] orange-ftgroup.com> |
I have an update to propose :
Im want replace :
-----------------------------------------------------------------------
if (ref($arg{To}) eq 'ARRAY') {
push @to, @{$arg{To}};
$toString = join ", ", @to;
} else {
push @to, $arg{To};
$toString = $arg{To};
}
if (ref($arg{Cc}) eq 'ARRAY') {
if (@{$arg{Cc}}) {
push @to, @{$arg{Cc}};
$ccString = join ", ", @{$arg{Cc}};
}
} else {
if ($arg{Cc}) {
push @to, $arg{Cc};
$ccString = $arg{Cc};
}
}
if (ref($arg{Bcc}) eq 'ARRAY') {
if (@{$arg{Bcc}}) {
push @to, @{$arg{Bcc}};
# No string for Bcc, because it's hidden
}
} else {
if ($arg{Bcc}) {
push @to, $arg{Bcc};
}
}
-----------------------------------------------------------------------
bye :
-----------------------------------------------------------------------
sub EpurEmail {
if ( /<.*>/ ) {
return substr($_, index($_, '<')+1, index($_, '>')-length($_));
}
return $_;
}
if (ref($arg{To}) eq 'ARRAY') {
$toString = join ", ", @{$arg{To}};
@{$arg{To}} = map(EpurEmail, @{$arg{To}});
push @to, @{$arg{To}};
} else {
$toString = $arg{To};
@{$arg{To}} = EpurEmail $arg{To};
push @to, $arg{To};
}
if (ref($arg{Cc}) eq 'ARRAY') {
if (@{$arg{Cc}}) {
$ccString = join ", ", @{$arg{Cc}};
@{$arg{Cc}} = map(EpurEmail, @{$arg{Cc}});
push @to, @{$arg{Cc}};
}
} else {
if ($arg{Cc}) {
$ccString = $arg{Cc};
$arg{Cc} = EpurEmail $arg{Cc};
push @to, $arg{Cc};
}
}
if (ref($arg{Bcc}) eq 'ARRAY') {
if (@{$arg{Bcc}}) {
@{$arg{Bcc}} = map(EpurEmail , @{$arg{Bcc}});
push @to, @{$arg{Bcc}};
# No string for Bcc, because it's hidden
}
} else {
if ($arg{Bcc}) {
$arg{Bcc} =EpurEmail $arg{Bcc};
push @to, $arg{Bcc};
}
}
-----------------------------------------------------------------------
With this modification you can send an email like this :
smtp = Net::SMTP::Multipart->new("mailrelay.someco.com");
$smtp->Header(To => 'You <someone\@someco.com
<mailto:thomas.guenneguez@orange-ftgroup.com>'> >',
Subj => "Multipart Mail Demo",
From => 'Me <me\@someco.com
<mailto:peo.supervision@orange-ftgroup.com>'> >');
$smtp->Text("This is the first text part of the message");
$smtp->FileAttach(["myfile.xls", "c:/tmp/myfile.xls"]);
$smtp->End();
Thanks
Thomas GUENNEGUEZ
France Télécom - FT/ROSI/DOE/DOSI/DPROD/DPSE/PEO
4, Avenue du vieil Etang - Montigny le Bretonneux
78067 Saint Quentin en Yvelines Cedex
<http://clicvoice.si.francetelecom.fr/user/validation_clickToDial.jsp?callee
ID=&lastName=Guenneguez&firstName=Thomas&calleeNumber=0675543211>
06.75.54.32.11 -
<http://clicvoice.si.francetelecom.fr/user/validation_clickToDial.jsp?callee
ID=&lastName=Guenneguez&firstName=Thomas&calleeNumber=0155882563>
01.55.88.25.63
Mail Générique :
ZZZ PEO <blocked::mailto:peo.supervision@francetelecom.com> Supervision
FAQ :
http://supnoo.si.francetelecom.fr/faq
*********************************
This message and any attachments (the "message") are confidential and
intended solely for the addressees. Any unauthorised
use or dissemination is prohibited.
Messages are susceptible to alteration. France Telecom Group shall not be
liable for the message if altered, changed or
falsified.
If you are not the intended addressee of this message, please cancel it
immediately and inform the sender.
********************************
*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised
use or dissemination is prohibited.
Messages are susceptible to alteration. France Telecom Group shall not be liable for the message if altered, changed or
falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************