/
Email Service (python)
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.