aspNetEmail

EmbeddedObject.ParseFile Method 

Creates an EmbeddedObject from a file path.

public static EmbeddedObject ParseFile(
   string contentId,
   string path
);

Parameters

contentId
The Content-Id to be used for creating the embedded object.
path
File path to the embedded object.

Return Value

An EmbeddedObject built from a file path.

Example

[C#]
            EmailMessage m = new EmailMessage("127.0.0.1" );
            m.From = "me@mycompany.com";
            m.To = "you@yourcompany.com";
            m.Subject = "testing email";
            m.Body = "what do you think of the new logo?<br><img src=\"cid:logo1\">";
            
            //enable logging for any troubleshooting problems
            m.Logging = true;
            m.LogPath = "c:\\email.log";
            
            //create the embedded image from a file
            EmbeddedObject eo = EmbeddedObject.ParseFile( "logo1", "c:\\temp\\companylogo.gif" );
            m.EmbedObject( eo );
            
            //send
            m.Send();
            
[VB.NET]
            Dim m As New EmailMessage("127.0.0.1")
            
            m.From = "me@mycompany.com"
            m.To = "you@yourcompany.com"
            m.Subject = "testing email"
            m.Body = "what do you think of the new logo?<br><img src=""cid:logo1"">"
            
            'enable logging for any troubleshooting problems
            m.Logging = True
            m.LogPath = "c:\email.log"
            
            'create the embedded image from a file
            Dim eo As EmbeddedObject = EmbeddedObject.ParseFile("logo1", "c:\temp\companylogo.gif")
            m.EmbedObject(eo)
            
            'send
            m.Send()
            
            

See Also

EmbeddedObject Class | aspNetEmail Namespace