Comments on: Sending email with embedded image https://www.limilabs.com/blog/sending-email-with-embedded-image Using Limilabs .net components Fri, 21 Jul 2017 11:28:28 +0000 hourly 1 https://wordpress.org/?v=6.6.2 By: Limilabs support https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-541113 Sat, 25 May 2013 20:11:46 +0000 http://www.limilabs.com/blog/?p=381#comment-541113 In reply to Andrzej.

@Andrzej

You just need to set Html property and use AddVisual method (if you want to reference those images from html content):

MailBuilder builder = new MailBuilder();
builder.Html = ...;
...
foreach(...)
{
    byte[] imageData = ...;
    string contentId = ...;
    MimeData visual = builder.AddVisual(imageData);
    visual.ContentType = ContentType.ImageJpeg;
    visual.ContentId = contentId;
}

If you want to add those images as regular attachments use AddAttachment method.

]]>
By: Andrzej https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-540940 Fri, 24 May 2013 12:14:24 +0000 http://www.limilabs.com/blog/?p=381#comment-540940 How to embed many pictures from database with IMail class?
The following code works with MailMessage class. How to modify it to work with IMail?

MailMessage msg = new MailMessage();
   
foreach (DataRow row in dt.Rows)
{
    byte[] image = (byte[])row["Data"];
    LinkedResource picture = new LinkedResource(new MemoryStream(image), "image/jpg");
    string conetntId = (string)row2["Name"];
    picture.ContentId = conetntId;
    htmlView.LinkedResources.Add(logo);
}

msg.AlternateViews.Add(htmlView);
]]>
By: Limilabs support https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-509880 Wed, 27 Mar 2013 07:17:47 +0000 http://www.limilabs.com/blog/?p=381#comment-509880 In reply to Julian.

@Julian,

Of course, just add visual elements several times:

IMail email = Fluent.Mail.Html(@"...")
    .AddVisual(@"c:\image1.jpg")
    .SetContentId("logo1@example.com")
    .AddVisual(@"c:\image2.jpg")
    .SetContentId("logo2@example.com")
    .Create()
...
MimeData visual1 = builder.AddVisual(@"c:\image1.jpg");
visual1.ContentId = "image1";

MimeData visual2 = builder.AddVisual(@"c:\image2.jpg");
visual2.ContentId = "image2";

Remember to use different content ids.

]]>
By: Julian https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-509567 Tue, 26 Mar 2013 19:46:12 +0000 http://www.limilabs.com/blog/?p=381#comment-509567 Is it possible to embed multiple images? I am pulling images (files name) from sql.
IMail email = Mail.Html(“”) _

]]>
By: Limilabs support https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-1419 Fri, 19 Nov 2010 16:14:43 +0000 http://www.limilabs.com/blog/?p=381#comment-1419 What is the stack-trace of the error?

However unlikely your smtp server might block your connection because you provided incorrect EHLO/HELO domain parameter (check out the Exchange article: http://support.microsoft.com/kb/291828).

Please try providing correct domain or use parameterless Ehlo method that uses your machine’s IP address.

Edit:
Mail.dll now issues correct EHLO/HELO automatically.

]]>
By: Farooq https://www.limilabs.com/blog/sending-email-with-embedded-image#comment-1418 Fri, 30 Jul 2010 16:14:34 +0000 http://www.limilabs.com/blog/?p=381#comment-1418 Hi,

I have done the major part of reading emails, manipulating emails and so on. I wanted to forward the email to another address. That works fine for Gmail but when I try to deploy it to my server it is giving me 5.5.4 Invalid Address error. Do you have any idea, how can I correct it?

Regards,
Farooq

]]>