Saturday, March 21, 2015

Send mail using Outlook and .oft templates

There is already a page for sending mail using Outlook library.
Now this small code is a small tweak i.e. using Outlook Template (*.oft) file.

If you see the code there is hardly any complication but this exercise is time consuming as a whole.
It is because defining the different mail templates takes a lot of time from business POV.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace emailTemplateTest {
 class Program {
  static void Main(string[] args) {
   try {
    Outlook.Application otApp = new Outlook.Application(); // create outlook object
    Outlook.NameSpace ns = otApp.Session;
    Outlook.Folder folder = otApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts) as Outlook.Folder;
    Outlook.MailItem otMsg = otApp.CreateItemFromTemplate(@ "d:\a2.oft", folder) as Outlook.MailItem; // Open the mail template
    Outlook.Inspector oInspector = otMsg.GetInspector;
    Outlook.Recipient otRecip = (Outlook.Recipient) otMsg.Recipients.Add("Temp@hotmail.com");
    if (otRecip.Resolve()) // validate recipient address
    {
     // Modify the body text as required
     otMsg.Send(); // Send Mail
     otRecip = null;
     otMsg = null;
     otApp.Quit();
    }
   } catch (Exception e) {
    Console.WriteLine("{0} Exception caught: ", e);
   }
  }
 }
}

66 comments:

  1. Raipur girls welcoming you to making you relax and happy by their top class physical services, and at the same time the independent Raipur Escorts are available at you reasonable price.
    http://www.raipurescort.com

    Raipur Escorts

    Raipur Escort

    Raipur Escorts service

    Raipur Escorts Agency

    Independent Raipur Escorts

    Independent Raipur Escort

    Raipur Escorts Girl

    Escorts in Raipur

    Escorts Service in Raipur

    ReplyDelete
  2. Welcome to High Class Surat Escorts Service, the luxurious Surat Escort Services where you can find the most beautiful Escort Sexy and Hot Call girls in Surat and Other Citys Best Escort Services in India.

    Surat Call Girl, Surat Escorts Service

    Surat Call Girls, Surat Escorts

    Call Girls in Surat, Surat Escort

    Surat Escorts, Call Girl in Surat

    Surat Escorts, Surat Escort Service

    ReplyDelete
  3. Mumbai Escorts sillky.in Do not be shy, tell your wish to me, experience-your objectives and should be to the really ecstasy that's me, the usually, the one, for you in here I will be a little, table beauty with awesome perspective, prolonged black smooth locks and interest that is hypnotic.
    Mumbai Escorts, Independent Mumbai Escorts http://sillky.in
    Mumbai Escorts Service, Mumbai Escort http://www.dimpy.in
    Mumbai Call Girl, Call Girls in Mumbai http://www.mumbaicallgirlservice.com
    Call Girl in Mumbai, Mumbai Call Girls http://www.callgirlservicemumbai.com
    Mumbai Escorts, Mumbai Call Girl Service http://www.callgirlinmumbaiescorts.com
    Mumbai Escorts, Mumbai Call Girls http://www.mumbaiescortss.biz
    Call Girl in Mumbai, Call Girls Service in Mumbai http://www.mumbaiescortscallgirl.com
    Mumbai Escorts, Call Girls in Mumbai http://www.meghnakaur.com

    ReplyDelete
  4. Welcome to High Class Surat Escorts Service, the luxurious Surat Escort Services where you can find the most beautiful Escort Sexy and Hot Call girls in Surat and Other Citys Best Escort Services in India.

    Visit The Site For More Details -: http://www.anuroy.com/

    Chennai Escorts, Chennai Call Girls

    Chennai Call Girl, Chennai Escorts Service

    Call Girls Chennai, Chennai Escort

    Chennai Escorts, Chennai Escorts Service

    Call Girls in Chennai, Chennai Escort

    ReplyDelete
  5. Nice And Informative Website. Please Keep Continue Such Kind Of Effort. I Shared Your Post With My Friends Also. I Run My Independent Mumbai Escorts Service. I Provide You High Class Mumbai Models And Beautiful Mumbai Call Girls. We Are Available To Serve You 24 X 7. For Booking Contact With Priya Singh Ph- 09987215552
    Wensite : http://www.escortagencyinmumbai.com/
    mumbai escorts service
    mumbai escorts
    mumbai escort service
    escort service in Mumbai
    mumbai call girls
    Andheri escorts
    Bandra escorts

    ReplyDelete
  6. mumbai escort provided beautiful modal,college girls for you.we have Independent Models, college girls for your Beautiful night
    mumbai escort

    ReplyDelete
  7. we are provided escort service in Mumbai 24 for hours with full arguments, our escorts all type services available for the unlimited time full enjoyment of our independent escort service in Mumbai

    Mumbai escort service

    Escort service in Mumbai

    independent escorts service in Mumbai

    Mumbai independent escorts

    Call girls in Mumbai

    Mumbai Call girls

    escorts service in Andheri

    Andheri escorts service

    ReplyDelete
  8. Udaipur call girls
    independent udaipur escorts
    escorts in udaipur
    Udaipur escorts service
    We are top service provider established in Udaipur city. There are many companion girl in Udaipur. But our girls fully educated and hot they know all the needs who want to need a man with her.

    ReplyDelete
  9. You can ask that closeness fulfillment what you lack from any woman yet. Each one of the three holes of her is reliably start for you with totally satisfying closeness delight. Typically consider any sex-related accepted and recognize it with our eye-getting Chandigarh Escorts.

    Chandigarh Escorts
    Chandigarh Escorts Service
    Escorts in Chandigarh

    ReplyDelete
  10. It is an extensive variety of data brings you towards the best one that would assistance be able to you satisfy your dreams. Albeit, numerous are there to have enough enthusiasm for meeting every one of your desires however certainly everybody has diverse.

    Noida Escorts
    Noida Escorts Services
    Escorts in Noida

    ReplyDelete
  11. It is center to numerous superb and appealing escort women as there is no insufficiency of amazing deceivability of appeal world there. That is the reason looking an appeal toy in the town isn't a testing procedure for anybody; the every one of the one need is simply to arrange bolster elements of an escort Agra with the individual details.

    Agra Escorts
    Agra Escorts Service
    Agra Escort

    ReplyDelete
  12. Our Chandigarh Escorts Service isn't for the people who are consistently hunting down recompenses and more since that are just particularly less than ideal. We simply offer administrations to our clients who are not easygoing about it and who require satisfaction in their life.

    Chandigarh Escorts
    Chandigarh Escorts Service
    Escort Service in Chandigarh

    ReplyDelete
  13. High class escorts in Chandigarh cherish working separately and going by to their customers all alone level and getting the administration charges straightforwardly from their customers to keep their full procuring. Along these lines, plainly free escorts are living better life in contrast with the individuals.

    Chandigarh Escorts
    Chandigarh Escorts Services
    Escorts in Chandigarh

    ReplyDelete
  14. The request of master and very much prepared escorts is expanding step by step in metro urban areas so that in Noida. I am absolutely eager about the Noida escorts girls gave by for you. One of our clients showed that he got the ever best sexual involvement with our friend woman.

    http://www.hunny.co.in/
    http://www.noidaescort.com/
    http://www.noida-escorts.co.in/
    http://www.feelofhaven.in/
    http://www.lovedesire.in/
    http://www.noidaescorts.ind.in/
    http://www.noidaescorts.net.in/

    ReplyDelete
  15. They need aid further separated under Different types: model, airhostess, camera person and so on. Though photography may be your pastime afterward this kind from claiming will make a perfect one sets for you. escorts service in mumbai
    Call Girls Mumbai
    andheri escorts
    mumbai call girls services
    mumbai escorts
    andheri escorts service
    wadala call girls
    vashi call girls
    mumbai call girls services

    ReplyDelete
  16. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours.

    ReplyDelete
  17. Your Website Is Nice And Informative. Please Keep Continue Such Kind Of Good Effort. My Name Is Ritu Sharma. I Run My Own Independent Mumbai Escorts Service. I Provide You VIP And Independent Escort Service In Low Cost. You Can Avail My Mumbai Escort Service At Your Own Place Or In Hotel. I Am Available To Serve You 24 X 7. If You Want To Test Me, Visit- www.escortservicemumbai.net Please Call Me- +91 9OO4OO9481
    Independent Mumbai Escorts Service
    mumbai escorts
    mumbai escort service
    escort service in mumbai
    independent mumbai escorts
    Independent escorts service
    independent escorts

    ReplyDelete
  18. Hi
    I read your articles. Your all article is very informative. Thank for sharing.
    Chennai Escorts
    Chennai escorts

    ReplyDelete
  19. I Read your blog and i found that its a full of informative data thank you for posting.

    Chennai Escorts
    Chennai Escorts

    ReplyDelete
  20. Hi,
    Thank You for sharing new article. It is very informative article.
    Chennai Escorts
    Chennai escorts

    ReplyDelete
  21. I Read your blog and i found that its a full of informative data thank you for posting.

    Chennai Escorts
    Chennai Escorts

    ReplyDelete
  22. The way in which you explain the things are simply amazing. You should keep writing more stuff like this. Please have a look at my official website if you are interested in hiring best Mumbai Escorts.

    ReplyDelete
  23. You have to keep up something which you may take a gander at donning at some point or another despite the fact that. Distributions which focus on design issues are a simple method to get styles specifically to your letter drop.
    Candigarh escorts
    Chandigarh escorts service
    Escort in Chandigarh
    Escorts service in Chandigarh
    Chandigarh Call Girls service

    ReplyDelete
  24. There are boundless additional items created basically for hair. Head of hair additional items are stuff like locks bows, headbands and pig tail stands, yet they likewise join your hair expansions.
    Noida escorts
    Noida escorts service
    Noida escorts services
    escorts in Noida
    escorts service in Noida
    Noida Call Girls service

    ReplyDelete
  25. My Vadodara escorts benefit is accessible as completely proficient yet much-modified compose in order to suit your preferences and wants. Get with me to feel the distinction that you..

    visit the website for more details -:Vadodara Escorts

    Vadodara Escorts, Vadodra Escorts Service

    Vadodara Call Girls, Vadodara Escorts

    Call Girls in Vadodara, Vadodara Escort

    Vadodara Call Girl, Call Girls Service in Vadodara

    Vadodara Escorts, Call Girls in Vadodara

    Vadodara escorts benefit giving you autonomous escorts in Vadodara, implies you can appreciate benefit with more joy and love every free escort are experts and experienced.

    ReplyDelete
  26. Mumbai Escorts- Independent High Profile VIP Call Girls in Mumbai.For decent and sizzling mumbai Escorts Services of Call Girls, Independent Mumbai Escorts and fashionable excessive class Mumbai name women. The maximum cute and erotic http://www.Escortservicesmumbai.Com/ http://www.Escortgirlinmumbai.Com/ mumbai escorts, mumbai escorts carrier, mumbai escorts enterprise, mumbai independent escorts, mumbai lady escorts, name girls in mumbai, karishma sharma, mumbai name women, independent mumbai escorts, unbiased name women mumbai, vip call girls, high profile call women mumbai.Escort provider is to be had at an cheap fee. We provide the most stunning name girls and now you can call for Escort offerings. We provide completely agreed ladies in Mumbai

    ReplyDelete
  27. I think this is best platform for getting new world's information. You are working with time. Great job. Thank you

    delhi russian escorts

    http://blog.jaskaur.in/

    Independent Escorts in Delhi
    Call girls in Delhi
    Delhi Russian Escorts
    Aerocity escorts
    Mahipalpur escorts
    Karol Bagh escort

    ReplyDelete
  28. I request you to write some vlogs for my website and I can also provide you backlinks to your website plz visit
    Call girls in Guwahati
    Call girls in Bangalore
    Call girls in Bangalore
    Call Girls in Jammu
    Call Girls in Noida

    ReplyDelete
  29. Thanks for your amazing post Visit our website in case you want to make your trip romantic
    Escorts in Gurgaon
    Escorts in Kolkata
    Escorts in Kolkata
    Escorts in Pune
    Escorts in Pune

    ReplyDelete
  30. I request you to write some vlogs for my website and I can also provide you backlinks to your website plz visit
    Escorts in Guwahati
    Escorts in Bangalore
    Escorts in Bangalore
    Escorts in Jammu
    Escorts in Noida

    ReplyDelete
  31. Welcome to High Class Ahmedabad Escorts Service, the luxurious Ahmedabad Escort Services where you can find the most beautiful Escort Sexy and Hot Call girls in Ahmedabad and Other Citys Best Escort Services in India.

    Visit The Website For More Details -: Ahmedabad Escorts

    Ahmedabad Call Girl, Ahmedabad Escorts

    Ahmedabad Escorts Service, Ahmedabad Escorts

    Call Girls in Ahmedabad, Ahmedabad Escorts

    Ahmedabad Escorts, Ahmedabad Call Girls

    Ahmedabad Call Girl, Call Girls in Ahmedabad

    Call Girls in Ahmedabad, Ahmedabad Escorts Service

    Ahmedabad Escorts Service Call Girls in Ahmedabad

    Ahmedabad Escorts, Ahmedabad Call Girls

    The young ladies you will discover working with 100% fulfillment top south young ladies Ahmedabad escorts ,all genuine south Ahmedabad Service. In this way, our south Ahmedabad escorts young ladies are very looked for after and they are the heartthrobs to the men.

    ReplyDelete