Greetings esteemed monks
I have an application which takes the incoming mail and spilts into entities using MIME::Parser and puts the mail entities in a randomly created directories for further spam checks. The structure will be like
j7BCVOSY008289 j7BCVOSY008289.header j7BD5BAI008933 j7BD5BAI008933.
+header
contents of j7BCVOSY008289 => msg-24072-2.html sample_image.gif
contents of j7BD5BAI008933 => msg-24072-3.txt msg-24072-4.html
Now, for each mail entity which has an *.html file, I'd like to add an image one
on top of the content (just after <body> tag) and one image at the bottom (just before </body> tag), similar to the code below
$msg = MIME::Lite->new(
To =>'you@yourhost.com',
Subject =>'HTML with in-line images!',
Type =>'multipart/related'
);
$msg->attach(Type => 'text/html',
Data => qq{ <body>
Here's <i>my</i> image:
<img src="cid:head_image.jpg">
Some content here..blah blah blah
<img src="cid:bottom_image.jpg">
</body> }
);
$msg->attach(Type => 'image/jpg',
Id => 'head_image.jpg',
Path => '/path/to/head_image.jpg',
);
$msg->attach(Type => 'image/jpg',
Id => 'bottom_image.jpg',
Path => '/path/to/bottom_image.jpg',
);
I'm a little confused going about adding new entities to already splitted entities.
Can someone give me an idea about going about the same. How this can be achieved using MIME::Tools
Thank you in advance for your time
May the force be with you !!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.