cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to send the result as email?

Fabrica_AE
MEGA Partner
MEGA Partner

Hi community. 

 

 

I'm using this macro: 

 

Sub testDate()

Dim colApplis, oAppli, cpt, strResult, myDate
Dim total as integer
sum = 0
Set colApplis = megaEnv.getRoot.getCollection("~FN8AHc2gITnL[Software Technology]")
For Each oAppli In colApplis
myDate = oAppli.getProp("~1RLnmMCJX9ZK[Fecha Fin]")
If myDate <> "" Then'
total = CDate(myDate) - Date
If total <= 90 Then
sum = sum + 1
strResult = strResult & " - " & oAppli.getProp("short name") & vbLf
End If
End If
Next
If sum > 0 Then
Dim msg as String

msg = "Check these: " & sum & "," & _
" software Technology:" & vbLf & strResult

MsgBox msg

End If

End Sub

Call testDate

 

It works fine, it counts the Software Technology elements, but my question is, How can i send the result of that macro (pop-up that shows a list of software technology elements) as email? which is the best way to do that? 

1 Reply

lionel
MEGA
MEGA

Hello,

please remember to always tell us the version of Hopex you are using.

If you have correctly parameterized everything (screenshot concerns a V3 version)  :

paramMail.png

Then you can easily send an email. Here is an example of function you could call :

 

Function sendAlert(oRoot, msg)
  Dim objMailSender
  Set objMailSender = oRoot.CurrentEnvironment.Toolkit.MegaMailSender
  objMailSender.Subject = "Your subject for this email"
  objMailSender.Body = msg
  objMailSender.Recipients.Insert "yourrecepient1@fabrica.com"
  objMailSender.Recipients.Insert "yourrecepient2@fabrica.com" 'Add as many as you want
  objMailSender.SmtpSend
End Function