Solved

Conditional Email via Qapp in Netbrain

  • 6 October 2021
  • 1 reply
  • 37 views

Userlevel 2

Hi Team,

 

Can you please let me know how we can accomplish this in a Qapp - Sending email to stakeholders Only if certain conditions are met. 

 

Thanks  !

icon

Best answer by pradeep.gaddameedi 6 October 2021, 10:52

View original

1 reply

Userlevel 1

Hello,

You can use the function "SendEmail(emailInfo)" which can be imported from netbrain.sysapi.datamodel.

Below is a sample code:

from netbrain.sysapi import datamodel 


mailContent = {
"subject":"NetBrain Alert",
"body":"<html><body>Hello, <br>This is a sample alert </body>",
"recipients":["user@netbraintech.com"],
"Ccs":["user2@netbraintech.com"],
"attachments":[{"content":"place,location\ndalian_beach, dalian\nqingdao_beach,qingdao", "contenttype":"text/csv", "filename":"place.csv"},
{"content":"This is a sample alert ,\n this is a new line", "contenttype":"text/plain; charset=us-ascii","filename":"test.txt"}]
}

datamodel.SendEmail(mailContent)

 

Sample email sent by this script:

 

 

Thankyou.

Reply


Community |  Ideas

Facebook |  Instagram |  Youtube |  Twitter |  LinkedIn
Privacy & Security Statement  |  Terms & Conditions |  Impressum  |  UK Modern Slavery Statement