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 !
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 !
Best answer by pradeep.gaddameedi
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.
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.