{"id":729,"date":"2011-11-18T00:52:26","date_gmt":"2011-11-17T19:22:26","guid":{"rendered":"http:\/\/www.automationrepository.com\/?p=729"},"modified":"2011-11-18T01:15:37","modified_gmt":"2011-11-17T19:45:37","slug":"how-to-send-emails-using-qtp-from-microsoft-outlook","status":"publish","type":"post","link":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/","title":{"rendered":"How to send emails using QTP from Microsoft Outlook"},"content":{"rendered":"<div style=\"font-family: Verdana; text-align: justify;\">\n<p style=\"text-align: justify;\">In the <a title=\"How to send emails using QTP from Gmail and Yahoo\" href=\"http:\/\/www.automationrepository.com\/2011\/11\/how-to-send-emails-using-qtp-from-gmail-and-yahoo\/\">previous article<\/a>, we saw how to send emails from\u00a0 QTP via Gmail &amp; Yahoo Mail. There we wrote the code that connects to GMail\/Yahoo SMTP Server and sends mails to any email id. But if you have MS Outlook installed in your machine, you can directly use Outlook to send emails to <!--more-->the required mail ids.\u00a0 Also, the code to send mails from Outlook is relatively simpler than code for sending mails from Gmail\/Yahoo using Microsoft CDO technology. Let&#8217;s see how the code works &#8211;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nFunction fnSendEmailFromOutlook\r\n\r\n'Create an object of type Outlook\r\nSet objOutlook = CreateObject(&quot;Outlook.Application&quot;)\r\nSet myMail = objOutlook.CreateItem(0)\r\n\r\n'Set the email properties\r\nmyMail.To = &quot;some_mail_id@gmail.com&quot;\r\nmyMail.CC = &quot;some_mail_id_2@gmail.com; some_other_mail@yahoo.com&quot; 'Sending mails to multiple ids\r\nmyMail.BCC = &quot;&quot; 'If BCC is not required, then this line can be omitted\r\nmyMail.Subject = &quot;Sending mail from MS Outlook using QTP&quot;\r\nmyMail.Body= &quot;Test Mail Contents&quot;\r\nmyMail.Attachments.Add(&quot;D:\\Attachment.txt&quot;) 'Path of the file to be attached\r\n\r\n'Send the mail\r\nmyMail.Send\r\nWait(3)\r\n\r\n'Clear object reference\r\nSet myMail = Nothing\r\nSet objOutlook = Nothing\r\n\r\nEnd Function\r\n<\/pre>\n<p style=\"text-align: justify;\">Please let us know if the above code works for you. Please use the comments section or contacts form to get in contact with us regarding any issues\/suggestions. Happy Reading.. :&#8211;)<\/p>\n<p style=\"text-align: justify;\">\n<\/div>\n<div style=\"font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;\">\n<p>If you liked this article, you can join our blog to get new posts delivered directly in your inbox.<\/p>\n<form style=\"text-align: center;\" action=\"http:\/\/feedburner.google.com\/fb\/a\/mailverify\" method=\"post\" onsubmit=\"window.open('http:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=automationrepository\/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true\" target=\"popupwindow\"><input style=\"width: 160px; height: 20px;\" onfocus=\"if (this.value == 'Enter Your Email Address') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = 'Enter Your Email Address';}\" type=\"text\" value=\"Enter Your Email Address\" \/> <input type=\"hidden\" name=\"uri\" value=\"automationrepository\/feeds\" \/> <input type=\"hidden\" name=\"loc\" value=\"en_US\" \/> <input type=\"submit\" value=\"Join Us\" \/><\/p>\n<p style=\"text-align: justify;\">\n<\/form>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the previous article, we saw how to send emails from\u00a0 QTP via Gmail &amp; Yahoo Mail. There we wrote the code that connects to GMail\/Yahoo SMTP Server and sends mails to any email id. But if you have MS Outlook installed in your machine, you can directly use Outlook to send emails to<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[50],"class_list":["post-729","post","type-post","status-publish","format-standard","hentry","category-advanced-concepts","tag-email"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to send emails using QTP from Microsoft Outlook - XX<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anish Pillai\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/\",\"name\":\"How to send emails using QTP from Microsoft Outlook - XX\",\"isPartOf\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\"},\"datePublished\":\"2011-11-17T19:22:26+00:00\",\"dateModified\":\"2011-11-17T19:45:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.automationrepository.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to send emails using QTP from Microsoft Outlook\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/\",\"name\":\"XX\",\"description\":\"\\r\\nasas\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20\",\"name\":\"Anish Pillai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g\",\"caption\":\"Anish Pillai\"},\"description\":\"Find more about Anish Pillai on Google+\",\"sameAs\":[\"http:\/\/www.automationrepository.com\"],\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/author\/anish\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to send emails using QTP from Microsoft Outlook - XX","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/","twitter_misc":{"Written by":"Anish Pillai","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/","url":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/","name":"How to send emails using QTP from Microsoft Outlook - XX","isPartOf":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#website"},"datePublished":"2011-11-17T19:22:26+00:00","dateModified":"2011-11-17T19:45:37+00:00","author":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20"},"breadcrumb":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/11\/how-to-send-emails-using-qtp-from-microsoft-outlook\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.automationrepository.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"How to send emails using QTP from Microsoft Outlook"}]},{"@type":"WebSite","@id":"https:\/\/www.automationrepository.com\/wordpress\/#website","url":"https:\/\/www.automationrepository.com\/wordpress\/","name":"XX","description":"\r\nasas","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20","name":"Anish Pillai","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g","caption":"Anish Pillai"},"description":"Find more about Anish Pillai on Google+","sameAs":["http:\/\/www.automationrepository.com"],"url":"https:\/\/www.automationrepository.com\/wordpress\/author\/anish\/"}]}},"_links":{"self":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/comments?post=729"}],"version-history":[{"count":9,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/729\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/729\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/media?parent=729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/categories?post=729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/tags?post=729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}