NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Email Service (python)
Wrapper for the '/email' APIs.
List of all options:
- Send custom email
- Send email to a user
Simple email message
from trivoreid.models.email import Email # send to one email email = Email() email.construct_email(to='example1@mail.com', from_email='example2@mail.com', subject='Subject', text='Emample text body') api.email_service.send(email) # send to multiple emails email.construct_email(to=['example1@trivore.com', 'example2@trivore.com'], from_email='example2@mail.com', subject='Subject', text='Emample text body')
Advanced options
from trivoreid.models.email import Email, EmailAttachments attachments = EmailAttachments() attachments.add_attachment(name='attachment.txt', data=data) attachments.add_attachment(name='attachment2.txt', data=data2) email = Email() email.construct_email(to=['example1@mail.com', 'example2@mail.com', 'example3@mail.com'], cc=['example1@mail.com', 'example2@mail.com', 'example3@mail.com'], bcc=['example1@mail.com', 'example2@mail.com', 'example3@mail.com'], from_email='example@mail.com', reply_to=['example1@mail.com', 'example2@mail.com', 'example3@mail.com'], subject='Example subject', html='Hello <b>there</b>', attachments=attachments) api.email_service.send(email)
Send email to a user
from trivoreid.models.email import Email email = Email() email.construct_email(from_email='example2@mail.com', subject='Subject', text='Emample text body') api.email_service.send_to_user(email, userId)
Send email to all group members
Sending email to all primary (first) email addresses of users that belong to the defined groups.
email = Email() email.text = 'Example text body.' email.subject = 'Example subject' email.from_email = 'example@trivore.com' api.email_service.send_to_group_members(nsCode, email, 'groupName1', 'groupName2', 'groupName3') ### send email as bcc api.email_service.send_to_group_members(nsCode, email, 'groupName4', 'groupName5', 'groupName6', bcc=True)
Email Service Models
/wiki/spaces/TISpubdoc/pages/20515269