I have used the solution for borders around images for outlook by creating a containing table with a border instead.
but a problem occurs if an image is not placed in the box, ( as the image is optional ) the table remains leaving a small box where the image should be.
How can i make the table disappear?
If I correctly understand what you're asking for, then this can easily be accomplished. You can wrap any element in a repeater and simply "delete" it within the editor when it's not needed. You can do this with any element (<tr>'s, <td>'s, <table>'s, etc.).
I typically use borders only in <td>'s, so here's an example of removing a row from a table in which the image is surrounded by a border:
<table width="304" align="center" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="304">This is the line of text above the image</td> </tr> <repeater> <tr> <td width="300" style="border:2px solid #000000;"><img src="<$imagesrc link='true'$>" width="300" border="0" style="display:block;"></td> </tr> </repeater> <tr> <td width="304">This is the line of text below the image</td> </tr> </table>