Hi,
Thanks for all your help.
I have another issue: The html images are not being embedded in the body of the email message.
Is there another switch or property that needs to be used to allow images to embed (show)?
My code is below.
Thanks again,
Kevin
MailMessage message = MailMessage.Load(strOftTemplatePath, MessageFormat.Msg);
message.Sender = new MailAddress("test@test.com");
message.To.Add(new MailAddress("test@test.com"));
message.Subject = message.Subject.Replace(“subject”, strTitle);
message.HtmlBody = message.HtmlBody.Replace(“body”, strHtmlSource);
MapiMessage msg = MapiMessage.FromMailMessage(message);
msg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
msg.Save(strDirPath + “test.msg”);
Hi Kevin,
Sorry for the trouble you are facing.
Please have a look at the following code for your kind reference. It generates a new MailMessage and embeds a new inline image in it. It then saves the message in OFT as well MSG format. If you still find any difficulty, or have any issue in this regard, feel free to write to us.
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>
<![endif]–>
// Create mail message
MailMessage message = new MailMessage();
message.Sender = new MailAddress("Sender@doamain.com", "Sender Information");
message.Subject = "This message is generated by Aspose";
message.To = new MailAddress("to@doamian.com", " Recepient one");
message.CC = new MailAddress("to@doamian.com", " Recepient Two");
// Set HTML body of message. Use image source
message.HtmlBody = "This
text will appear bold" + "<br/?
Here is embeded image ";
// Initialize linked resource for image
string strImagePath = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg";
LinkedResource image = new LinkedResource(strImagePath);
image.ContentId = "logo";
// Add image to linked resoorce
message.LinkedResources.Add(image);
//Save as OFT
message.Save("mail.oft", MailMessageSaveType.OutlookMessageFormatUnicode);
//Create MapiMessage from MailMessage
MapiMessage mapiMsg = MapiMessage.FromMailMessage(message);
//Set message flag to unsent
mapiMsg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
//Save as MSG
mapiMsg.Save("test.msg");
Hi,
The image is now being embedded but the entire message, including the image, is rendered three times in the email (see attached image). There is also an added “<” character in the upper left-hand corner (also visible on attached image).
Plus a license text file is attached and the subject has the added text: Aspose.Email Evaluation.
I am currently using an evaluation version of the Aspose DLL.
My company is interested in purchasing the license providing the product will work properly once licensed.
We create many OFT templates manually and this would be great if I can be sure it will work.
Thanks,
Kevin
Hi Kevin,
Okay. I’ve signed up for the temporary license. Here is my order number: 121005143110
Where do I get the license and how do I apply it to the downloaded DLL?
Thanks,
Kevin
Hi Kevin,
license.SetLicense(LicenseFileName);