Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Embedded, not Downloaded, Images? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
LSpencer777
Newbie
Newbie
Avatar

Joined: 08 September 2007
Location: United States
Online Status: Offline
Posts: 1
Posted: 08 September 2007 at 12:11pm | IP Logged Quote LSpencer777

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 View LSpencer777's Profile Search for other posts by LSpencer777
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 09 September 2007 at 5:17am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
jonr
Newbie
Newbie
Avatar

Joined: 04 December 2007
Location: Iceland
Online Status: Offline
Posts: 8
Posted: 04 December 2007 at 7:34am | IP Logged Quote jonr

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 View jonr's Profile Search for other posts by jonr Visit jonr's Homepage
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 04 December 2007 at 8:20am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
jonr
Newbie
Newbie
Avatar

Joined: 04 December 2007
Location: Iceland
Online Status: Offline
Posts: 8
Posted: 04 December 2007 at 8:47am | IP Logged Quote jonr

Thanks. Does it parse relative urls, or do I have to do that my self?

J.
Back to Top View jonr's Profile Search for other posts by jonr Visit jonr's Homepage
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 04 December 2007 at 8:52am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
jonr
Newbie
Newbie
Avatar

Joined: 04 December 2007
Location: Iceland
Online Status: Offline
Posts: 8
Posted: 06 December 2007 at 8:50am | IP Logged Quote jonr

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 View jonr's Profile Search for other posts by jonr Visit jonr's Homepage
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 06 December 2007 at 9:40am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide