in reply to Attaching images to email html template help!
# I'd like to have a system that would allow me # to add as many images as possible to my template file here # instead of multiple hashes, is that possible? my %img_in; ... my %img_sec; ...
If I'm understanding you correctly, you want an array of hashes holding the image info:
my @imgs = ( { Type => 'image/gif', ID => 'logo', Path => '/images/logo.gif', Filename => 'logo.gif', Disposition => 'attachment', }, { Type => 'image/gif', ID => 'footer', Path => '/images/footer.gif', Filename => 'footer.gif', Disposition => 'attachment', }, # ... );
(of course, you could also fill the hashes dynamically...)
You should then be able to iterate over / attach them as follows
for my $img (@imgs ) { $msg->attach( %$img ) or die "Error adding $img->{Filename}: $!\n" +; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Attaching images to email html template help!
by Anonymous Monk on Mar 17, 2011 at 17:42 UTC | |
by Eliya (Vicar) on Mar 17, 2011 at 17:50 UTC | |
by Anonymous Monk on Mar 17, 2011 at 17:54 UTC | |
by Anonymous Monk on Mar 17, 2011 at 17:47 UTC | |
by Eliya (Vicar) on Mar 17, 2011 at 18:03 UTC | |
|
Re^2: Attaching images to email html template help!
by Anonymous Monk on Mar 18, 2011 at 13:30 UTC | |
by Eliya (Vicar) on Mar 18, 2011 at 13:54 UTC |