Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Outlook question
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Currently I use something like this to send my email (as it has been succesfull for quite some time)

Code:
Set oUtlookApp = CreateObject("Outlook.Application")
Set newMail = oUtlookApp.CreateItem(0)
newMail.Subject = strSubject
newMail.Body = strMessageBody
newMail.To = strMailID_TO
newMail.CC = strMailID_CC
newMail.BCC = strMailID_BCC

If SendResultsInEmailMessage = 1 Then
        If strAttachment <> "" Then
                WScript.Sleep (3000) 'Wait(3)
                newMail.Attachments.Add (strAttachment)
        Else                  
                Exit Function
        End If                
        On Error Resume Next
End If

WScript.Sleep (3000) 'Wait(3)
newMail.Display            'Displays e-mail message window
WScript.Sleep (3000) 'Wait(3)
newMail.Send

Set nAmeSpace = Nothing
Set oUtlookApp = Nothing

Rescently i noticed that my emails are not being sent until I open Outlook.

So I added:
Code:
systemUtil.Run "OUTLOOK.EXE"

now i get 2 emails sent. If Outlook is open, i end up having two Outlook apps open.

Should not my original code just send my email without having to open Outlook?
Reply


Messages In This Thread
Outlook question - by mv8167 - 09-08-2012, 12:23 AM
RE: Outlook question - by freeboynil - 09-09-2012, 11:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Clicking a link in an outlook email using QTP kirti 0 5,623 06-15-2014, 01:25 AM
Last Post: kirti
  Getting Application Error while launching Outlook yogesh kancherla 3 3,234 10-29-2012, 12:17 PM
Last Post: krr
  Automating Outlook PrabhatN 14 15,978 09-08-2012, 02:01 AM
Last Post: Jiju8621
  Adding attachment to Outlook Email mv8167 4 5,526 05-09-2012, 10:52 PM
Last Post: mv8167
  Outlook confirmation message ksrikanth2k9 6 6,485 04-07-2011, 03:51 PM
Last Post: ksrikanth2k9

Forum Jump:


Users browsing this thread: 1 Guest(s)