Automated email

2 posts / 0 new
Last post
Ernesto Gurgel ...
Offline
Joined: 07/18/2020 - 07:15
Automated email

All the rest of the code that loads the current IDEA base being analyzed and converts an IDEA database to excel works. As well as opening the page to send email. But this part of the code is not working, that part would be responsible for automatically forwarding the email.  
 
'With OutlookMail, from that point "To" command, "CC", BCC, Subject, Body, Send dont work.
 

  •  Dim ToSend As String
  •  Dim MS As String
  •  ToSend = "img.email@corp.com"
  •  MS = "hello world"
  •  Dim OutlookApp As Object
  •  Dim OutlookMail As Object     
  •  Set db=Nothing
  •  Set OutApp = CreateObject("Outlook.Application")
  •  OutApp.Session.Logon
  •  Set OutMail = OutApp.CreateItem(0)
  •  With OutlookMail
  •   .To = ToSend
  •   .CC = ""
  •   .BCC = ""
  •   .Subject = ""
  •   .Body = MS
  •   .Send 'or.Display
  •  End With
  •   Set OutlookMail = Nothing
  •   Set OutlookApp = Nothing

 

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

Hi Ernesto,

IDEAScript doesn't allow the  end ... end with syntax.  You have to add each line separete.

So it should be:

OutlookMail.To = ToSend

OutlookMail.CC = ""

and so on.

Hopefully that will fix your problem.