2011-09-09 18 views
5

पर हाइपरलिंक जोड़ना माइक्रोसॉफ्ट आउटलुक का उपयोग करते हुए ई-मेल भेजते समय मैं अपने कोड में शरीर के ई-मेल के शरीर में फ़ाइल स्थानों और वेबसाइटों का हाइपरलिंक भेजना चाहता हूं omsg.Body । किसी भी तरह की सहायता का स्वागत किया जाएगा।माइक्रोसॉफ्ट आउटलुक ईमेल सी #

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"); 
    } 

उत्तर

5

सादे पाठ के बजाय शरीर के लिए HTML का उपयोग आप हाइपरलिंक के लिए मार्कअप शामिल करने के लिए अनुमति देगा:

oMsg.HTMLBody = "<html><body>"; 
oMsg.HTMLBody += textBox1.Text + " is ready for release attached is the Print and Routing"; 
oMsg.HTMLBody += "<p><a href='http://website.com'>Web Site</a></p></body></html>"; 

संपादित करें: HTMLBody संपत्ति को Body संपत्ति बदल दिया है।

+0

""; "

Web Site

"; ईमेल में दिखाएं –

+0

वर्कड परफेक्ट धन्यवाद –

7

MSDN से, लगता है कि आप olFormatHTML को BodyFormat सेट और HTMLBody संपत्ति का उपयोग कर सकते हैं:

oMsg.BodyFormat = olFormatHTML; // <-- Probably dont need this 
oMsg.HTMLBody = "<HTML><BODY>Enter the message text here.</BODY></HTML>"; 

HTMLBody पृष्ठ से, ऐसा लगता है कि यह आप के लिए BodyFormat सेट की तरह अगर आप HTMLBody संपत्ति का उपयोग करें, तो आप इसे सेटिंग छोड़ने में सक्षम होना चाहिए।

+2

+1 HTMLBody प्रॉपर्टी को इंगित करने के लिए। – RoccoC5

संबंधित मुद्दे