Skip to main content

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 Wed, 08/11/2021 - 14:19

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.