Author |
|
Luca Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 06 October 2005 at 9:14am | IP Logged
|
|
|
Hello,
I'm having a problem when importing .eml files with a background image whose name contains spaces. Using .GetBodyWithEmbeddedObjects method I obtain wrong html code since image name is not surrounded by quotes.
Suppose you use Outlook stationery to create an .eml file whose background is named "Blue Sky.JPG" (I could provide an example if needed, but it is a plain Outlook-generated email):
1) You load it with .ImportfromFile method
2) Then you try to obtain html (in order to see a preview) with .GetBodyWithEmbeddedObjects method
What you see in html code is something like:
<BODY background=C:\Blue Sky Background.JPG>
which is bad code since it hasn't got quotes around image name. Preview fails, and any further editing (which is what my software should allow for) will produce unpredictable results.
Tha same problem doesn't happen with SRC="..." tags.
This is some sample code, I could also privide an .eml example:
Dim omailer As New MailBee.SMTP
omailer.Message.ImportFromFile "C:\Blue Sky.eml"
html = omailer.Message.GetBodyWithEmbeddedObjects("C:\tmp")
Debug.Print html
Thank You
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 06 October 2005 at 12:10pm | IP Logged
|
|
|
The workaround is to use Message.GetBodyWithEmbeddedObjectsEx method.
It allows you to choose the way how to generate the filenames of embedded pictures.
By default, actual filenames are used (e.g. "C:\Blue Sky Background.JPG").
However, it's possible to tell MailBee to store embedded objects under temporary filenames which are generated according to the index number (e.g. "1.jpg", "2.jpg", etc).
The example below saves embedded pictures under the temporary filenames (such as "1.jpg" instead of "C:\Blue Sky Background.JPG"):
Code:
Dim omailer As New MailBee.SMTP
omailer.Message.ImportFromFile "C:\Blue Sky.eml"
html = omailer.Message.GetBodyWithEmbeddedObjectsEx("C:\tmp", , 2)
Debug.Print html
|
|
|
You may find detailed method description and examples in MailBee Objects documentation.
Regards,
Alex
|
Back to Top |
|
|