aspNetEmail

EmailMessage.EmbedImage Method 

EmbedImage will embed an image in a html email. By embedding an image, you will not need to link to the image externally. To reference an image from inside the html, follow the following examples.

public bool EmbedImage(
   string contentId,
   string filePathOrUrl
);

Parameters

contentId
The name of the embedded image that will be referenced from inside the html. In some email readers, contentId's are case sensitive, and need to be specified with the correct case from inside the html.
filePathOrUrl
The file path, or Url, of the image to embed in the html.

Return Value

Example

[C#]
		EmailMessage msg = new EmailMessage("Mail1.MyCompany.com");
		msg.FromAddress = "me@MyCompany.com";
		msg.AddTo( "you@YourCompany.com", "Billy Bob" );
		msg.Subject = "Company Logo";
		msg.Body = "Here is the logo <img src=\"cid:logo\>";
		msg.EmbedImage( "logo",@"c:\temp\logo.jpg");
		msg.Send();
		
[Visual Basic]
		Dim msg As New EmailMessage("Mail1.MyCompany.com")
		msg.FromAddress = "me@MyCompany.com"
		msg.AddTo("you@YourCompany.com", "Billy Bob")
		msg.AddCc("cc@YourCompany.com")
		msg.Bcc = "him@HisCompany.com"
		msg.Subject = "Company Logo"
		msg.Body = "Here is the logo <img src=""cid:logo"">"
		msg.EmbedImage("logo", "c:\temp\logo.jpg")
		msg.Send();
		

See Also

EmailMessage Class | aspNetEmail Namespace