When sending an e-mail using Microsoft Outlook I want to be able to send a hyperlink of file locations and websites in the body of the e-mail the body in my code is oMsg.Body. Any help would be greatly appreciated.
private void button13_Click(object sender, EventArgs e)
{
//Send Routing and Drawing to Dan
// Create the Outlook application by using inline initialization.
Outlook.Application oApp = new Outlook.Application();
//Create the new message by using the simplest approach.
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
//Add a recipient
Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add("email-address here");
oRecip.Resolve();
//Set the basic properties.
oMsg.Subject = textBox1.Text + " Job Release";
oMsg.Body = textBox1.Text + " is ready for release attached is the Print and Routing";
//Send the message. 6
oMsg.Send();
//Explicitly release objects.
oRecip = null;
oMsg = null;
oApp = null;
MessageBox.Show("Print and Routing Sent");
}
From MSDN, looks like you can set the BodyFormat
to olFormatHTML
and use the HTMLBody
property:
oMsg.BodyFormat = olFormatHTML; // <-- Probably dont need this
oMsg.HTMLBody = "<HTML><BODY>Enter the message text here.</BODY></HTML>";
From the HTMLBody
page, it looks like it sets the BodyFormat
for you if you use the HTMLBody
property, so you should be able to skip setting it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With