Author |
|
LSpencer777 Newbie
Joined: 08 September 2007 Location: United States
Online Status: Offline Posts: 1
|
Posted: 08 September 2007 at 12:11pm | IP Logged
|
|
|
I'd like to send HTML-formatted e-mails that include images. I'd prefer to send the images and then be free to delete them, so HTML like <img src="http://me.com/images/you.jpg"/> is not my first choice.
1) Am I crazy to prefer to send the images along with the e-mail? Most of the HTML e-mails I get point back to a server. What do they know that I don't know?
2) Can you point me to some sample code that accomplishes my objective? I've tried to include my images as attachments, and tie them to the HTML with <img src="cid:id1"/> but in hotmail the attachments display after the message, and the HTML body itself just shows gray squares.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 09 September 2007 at 5:17am | IP Logged
|
|
|
The idea to use <img src="cid:id1"> is correct but perhaps you're doing something else incorrectly. For instance, id1 should match Content-ID of the attachment you added.
For instance, MailMessage.Attachment.Add method allows you to specify Content-ID. Content-ID can be any string provided that you're using the same string in IMG SRC attribute.
Or, you can use MailMessage.LoadBodyText to automatically load the message from HTML file including embedded pictures. In this case, MailBee will replace actual paths with Content-IDs automatically.
If you're working with Smtp class, you can get MailMessage instance using Smtp.Message property.
Regards,
Alex
|
Back to Top |
|
|
jonr Newbie
Joined: 04 December 2007 Location: Iceland
Online Status: Offline Posts: 8
|
Posted: 04 December 2007 at 7:34am | IP Logged
|
|
|
LoadBodyText is almost exactly what I want. My application is sending out HTML emails generated from a webpage. Is there an option to tell LoadBodyText to NOT to embed images, but reference them? I really need both methods...
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 04 December 2007 at 8:20am | IP Logged
|
|
|
LoadBodyText can do this. Even more, it does this by default (to make embedded pictures be imported rather than referenced, options parameter needs to be set). If you're leaving options=ImportBodyOptions.None (or using the overload without options parameter), MailBee will simply load the specified file into the body.
Regards,
Alex
|
Back to Top |
|
|
jonr Newbie
Joined: 04 December 2007 Location: Iceland
Online Status: Offline Posts: 8
|
Posted: 04 December 2007 at 8:47am | IP Logged
|
|
|
Thanks. Does it parse relative urls, or do I have to do that my self?
J.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 04 December 2007 at 8:52am | IP Logged
|
|
|
If you're not requesting to do anything special, it does nothing but reads the file contents into the property value.
If all your images are relative, you can, however, add BASE tag to the document to define the root.
Regards,
Alex
|
Back to Top |
|
|
jonr Newbie
Joined: 04 December 2007 Location: Iceland
Online Status: Offline Posts: 8
|
Posted: 06 December 2007 at 8:50am | IP Logged
|
|
|
Ok, It seems that I am misunderstanding something. Can't I point MailMessage.LoadBodyText to a webpage and download it from there? Does it have to be a file on the disk?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 06 December 2007 at 9:40am | IP Logged
|
|
|
MailMessage.LoadBodyText allows you to download from a web location if you specify ImportBodyOptions.PathIsUri flag in options parameter value.
Regards,
Alex
|
Back to Top |
|
|