Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Outlook using QTP
#11
Solved: 11 Years, 4 Months, 3 Weeks ago
Hello,
I used the same script, but i'm getting error msg as "The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available"

plz tel me wats the problem... thanX in adv... Waiting for ur reply

Thanks and Regards
Deepika
Reply
#12
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,

try this,

Code:
Public Function SendMail(SendTo, Subject, Body,Attachment)
       Set ol =  CreateObject("Outlook.Application")
       Set Mail = ol.CreateItem(0)
       Mail.to = SendTo
       Mail.Subject = Subject
       Mail.Body = Body
If(Attachment <> "") Then
Mail.Attachments.Add(Attachment)
End IF
       Mail.Send

       Set Mail = nothing
       Set ol = nothing
      
End Function
Reply
#13
Solved: 11 Years, 4 Months, 3 Weeks ago
Please find the below code u would be able to send the mail through qtp


'Email generation VB Script snipet.
'venkat batchu
'Pre requisite: MS Outlook apllication up running on the desktop
'----------------------------------------------------------------------------------

Code:
Dim ToAddress
Dim Subject
Dim Body
Dim Attachment
Dim oUtlookApp, nAmeSpace, newMail

'SystemUtil.Run "C:\Program Files\Microsoft Office\Office11\OUTLOOK.EXE" 'This line should be enabled if the Outlook on the desktop is not running

ToAddress = "venkat.batchu@xxxx.com" ' Message recipient Address

Set oUtlookApp = CreateObject("Outlook.Application")

Set nAmeSpace = oUtlookApp.GetNamespace("MAPI")

Set newMail = oUtlookApp.CreateItem(0)

Subject = "Test Results of Login and Signoff" 'Message Subject you can update

Body = "To view the test results of login and signoff. " 'Message body you can update

newMail.Subject = Subject

newMail.Body = Body & vbCrLf

newMail.Recipients.Add(ToAddress)

newMail.Attachments.Add("C:\Documents and Settings\venkat.batchu\Desktop\Results\Log\LogFile.html") 'You can update attachment file name

newMail.Send

Set nAmeSpace = Nothing

Set oUtlookApp = Nothing

'end of the email generation code
===================================================================


Enjoy by sending mails through qtp..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting Email Body from Outlook waseem.khan.91 0 2,235 03-04-2019, 02:53 PM
Last Post: waseem.khan.91
  Extracting Email Body from Outlook waseem.khan.91 0 1,235 03-01-2019, 02:51 PM
Last Post: waseem.khan.91
  Unable to send an email from Outlook which is already opened as draft attiliv 0 2,260 03-24-2013, 11:14 AM
Last Post: attiliv
  Outlook automation issue - Report message in a shared mail box chsurya 0 2,716 03-11-2011, 06:33 PM
Last Post: chsurya
  MS OutLook Email Notification nelmanoj 0 2,535 12-27-2010, 01:05 PM
Last Post: nelmanoj

Forum Jump:


Users browsing this thread: 3 Guest(s)