-
Nov 16th, 2008, 08:32 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2.0] Formatting Autogenerated Emails
I'm not entirely sure if this should go in the C# or Office Dev forums, but here goes anyway:
I'm autogenerating an email from data contained within my program using the Outlook Interop Namespace (9.3.0.0).
Code:
Outlook.Application moApp = new Outlook.Application();
Outlook.MailItem oEmail = (Outlook.MailItem)moApp.CreateItem(Outlook.OlItemType.olMailItem);
oEmail.Subject = "Project " + ProjectName + "- Reference # " + dlog.RefNum.Text + " - " + Ref_Description.Text;
oEmail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
oEmail.Body = @"Refer to images " + Ref_Imgs.Text + @"
" + Ref_FullBodyDescription.Text + @"
PRIORITY: " + dlog.priority.Text + @"
Regards,
" + userName + @"
" + companyName;
This is OK, but a little plain: I would like to add some formatting: Italics on "Refer to images", Bold on "Priority", etc. I've had a few quick attempts with .olFormatHTML and .olFormatRichText, but with no luck. Any help would be appreciated. Thanks!
C# Express, 2005.
"Why do all my attempts at science end with me getting punched by batman?" xkcd.
| Pong| |
Sorry for not posting more often.
-
Nov 24th, 2008, 12:13 PM
#2
Re: [2.0] Formatting Autogenerated Emails
When it comes to emails, there should be an IsBodyHTML property to the mail object itself. Set that to true, then just use standard HTML formatting codes. <b></b> to bold, <i></i> to italic, and so on and so forth.
-
Nov 24th, 2008, 05:24 PM
#3
Thread Starter
Hyperactive Member
Re: [2.0] Formatting Autogenerated Emails
Awesome. It was a little more complicated than that: (I had to change the BodyHTML string property to a complete HTML format) but it works. Thanks for your help.
"Why do all my attempts at science end with me getting punched by batman?" xkcd.
| Pong| |
Sorry for not posting more often.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|