Hello Friends!!
In this post we will quickly see how to send an outlook email.
I know, most of you all know how to send email using QTP, then why this post??
Well, here we will see how to use HTML code to format your email's body i.e. text style, font color, formatting etc. Here we go!!
Dim oOutlook, oEmail, vEmailTo, vEmailCC, vEmailBCC
vEmailTo = "catchall1@email.com" 'replace this with your email id
vEmailCC = "catchall2@email.com"
vEmailBCC = "catchall3@email.com"
vEmailSubject = "Test Email from QTPschool.com"
Set oOutlook = CreateObject("Outlook.Application")
Set oEmail = oOutlook.CreateItem(0)
oEmail.To = vEmailTo
oEmail.CC = vEmailCC
oEmail.BCC = vEmailBCC
oEmail.Subject = vEmailSubject
oEmail.HTMLBody = "<HTML>"&_
"<Body>"&_
"<p Style=""background-color:red""><b>This text is bold and red background</b></p>"&_
"<p><strong>This text is strong</strong></p>"&_
"<p><em>This text is emphasized</em></p>"&_
"<p><Font color=""green""<i>This text is green and italic</Font></i></p>"&_
"<p><Font color=""red"" size = 16><small>This text is red and big!</small></Font></p>"&_
"<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>"&_
"</Body>"&_
"</HTML>"
wait 2
oEmail.Send
wait 2
Set oEmail = Nothing
Set oOutlook = Nothing
'For more details on HTML code, please visit http://www.w3schools.com/html/html_formatting.asp
In case of any queries, please post your comments. Happy QTPing!!
In this post we will quickly see how to send an outlook email.
I know, most of you all know how to send email using QTP, then why this post??
Well, here we will see how to use HTML code to format your email's body i.e. text style, font color, formatting etc. Here we go!!
Dim oOutlook, oEmail, vEmailTo, vEmailCC, vEmailBCC
vEmailTo = "catchall1@email.com" 'replace this with your email id
vEmailCC = "catchall2@email.com"
vEmailBCC = "catchall3@email.com"
vEmailSubject = "Test Email from QTPschool.com"
Set oOutlook = CreateObject("Outlook.Application")
Set oEmail = oOutlook.CreateItem(0)
oEmail.To = vEmailTo
oEmail.CC = vEmailCC
oEmail.BCC = vEmailBCC
oEmail.Subject = vEmailSubject
oEmail.HTMLBody = "<HTML>"&_
"<Body>"&_
"<p Style=""background-color:red""><b>This text is bold and red background</b></p>"&_
"<p><strong>This text is strong</strong></p>"&_
"<p><em>This text is emphasized</em></p>"&_
"<p><Font color=""green""<i>This text is green and italic</Font></i></p>"&_
"<p><Font color=""red"" size = 16><small>This text is red and big!</small></Font></p>"&_
"<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>"&_
"</Body>"&_
"</HTML>"
wait 2
oEmail.Send
wait 2
Set oEmail = Nothing
Set oOutlook = Nothing
'For more details on HTML code, please visit http://www.w3schools.com/html/html_formatting.asp
In case of any queries, please post your comments. Happy QTPing!!
This comment has been removed by a blog administrator.
ReplyDeleteHi abhihshek,
ReplyDeleteThank you the for code.
but want to type three line in outlook using for loop
for example
Test Set -1
Total Passed =20
Total Failed = 3
Test Set -2
Total Passed =21
Total Failed = 2
Test Set -3
Total Passed =29
Total Failed = 2
.. like this for all the test set executed.
could you please help with the code or an idea so that i can implement in my driver script.
Thanks In Advance.
Gautam Grover
gautamgrover88@gmail.com
Many a times, important documents are shared through emails. In that case email document management becomes a requirement. Not to worry as Grexit makes email document management fast and easy. Grexit brings to you a secured way of email storage and customer email management.
ReplyDeletehttp://800supportnet.deviantart.com/art/Password-Change-How-do-I-change-My-Google-Account-620293603?ga_submit_new=10%253A1467953049
I appreciated your work very thanks hotmail.com
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteUtilizing 'Viewpoint Connector,' booked to be accessible worldwide in the not so distant future in 11 dialects, buyers can see and deal with their records from Outlook for nothing, with full contact, email, and email envelope synchronization. iniciar sesion hotmail
ReplyDeleteUseful post, thanks! I want to recommend one great tool that reveals personal emails and phone numbers from social networks: improver.io — check it out!find email from linkedin
ReplyDeletePretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info Plagiarism detector
ReplyDeleteThe email benefit is additionally effectively accessible as you simply need to drop a mail and the officials will return quickly with the correct solution for your answer. Hotmail
ReplyDeleteI think that thanks for the valuabe information and insights you have so provided here. hotmail email login
ReplyDeleteIt is an informative post.
ReplyDeleteOutlook email takes up a lot of time. Estimates vary on exactly how much time we spend email. But the above method save even just a little bit of time on a lot of tasks, those times savings can really add up. Random Password Generator Online
ReplyDeletePost your offers and email sign-up links on Google+. You can also add links on About section on your Google+ profile.Email List for Marketing
ReplyDeleteIt is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait reading. I am impressed with your work and skill. Thanks. visit this site
ReplyDeleteNew web site is looking good. Thanks for the great effort. ActiveCampaign Sales Automation
ReplyDeleteIm no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that.
ReplyDeleteemail search tool
hello!! Very interesting discussion glad that I came across such informative post. Keep up the good work friend. Glad to be part of your net community. email search tool
ReplyDeleteThanks for your insight for your fantastic posting. I’m exhilarated I have taken the time to see this. It is not enough; I will visit your site every day. visit this site
ReplyDeletethank you for this such a good information about hotmail email login on www.hotmail.com
ReplyDeleteYou make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. Visit the site here
ReplyDeletethank you for this awesome and informative post www.hotmail.com
ReplyDeleteHowever, the average home-schooling parent or guardian sees their child on a regular basis for a few hours a day (when that parent or guardian is teaching). You will learn together!martial arts lees summit
ReplyDeleteBut then again there are such huge numbers of people and gatherings attempting to make learning fun and pleasant, not a troublesome encounter. online Quran teachers
ReplyDeleteJazakom Allah khayra
ReplyDeleteJazakom Allah khayra
ReplyDeleteI wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts. https://hotmail-account.email
ReplyDeleteWow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also. hotmail.com
ReplyDeleteRegardless of whether it's secondary school or school level classes, your advantage and execution will help point you a general way of a lifelong way. Your inclination is revealed by something other than a couple of tests. Frequently it's appeared in your aptitude and level of investment in different classes. C2 proficient cpe
ReplyDeleteThe securing on an online degree in a specialized curriculum can help you in procuring better profession openings and going for well-paying employments. In any case, before joining up with a school or college, ensure that it is authorize. On the off chance that you can, attempt to get criticism from people who have finished the program. CPR Certification
ReplyDeleteI am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. aprenda como entrar no Hotmail direto
ReplyDeleteSince having the proper footwear will be men's or women's players best ally on the field, new technological advances give us the ability to provide soccer cleats that have superior traction and control without sacrificing speed or flexibility. 스포츠티비
ReplyDeleteYour blog never ceases to amaze me, it is very well written and organized..~~”` send big files
ReplyDelete