- Centro de Aprendizagem
- Mitte Pro
- Documentação da API
- Mitte Pro Client
- Client com template
Em Python
from mittepro.models import Mail from mittepro.client import MittePro mittepro = MittePro(key='<your_account_public_key>', secret='<your_account_secret_key>') def send(self): mail = Mail( recipient_list=[ 'Foo Bar <foo.bar@gmail.com>', 'Fulano <fulano@gmail.com>', '<ciclano@gmail.com>' ], from_name='Beutrano', from_email='beutrano@gmail.com', template_slug='test-101', context={'foobar': True}, context_per_recipient={ "foo.bar@gmail.com": {"foo": True}, "fulano@gmail.com.br": {"bar": True} }, use_tpl_default_subject=True, use_tpl_default_email=False, use_tpl_default_name=False ) response = mittepro.send_template(mail)
Em NodeJs
'use strict'; var MittePro = require('mittepro-js'); var templateMail = new MittePro.Mail({ recipientList: ['Foo Bar <foo.bar@mail.com>', 'Fulano <fulano@mail.com>', '<ciclano@mail.com>'], from: 'Beutrano <beutrano@mail.com>', templateSlug: 'test-101', context: {'foobar': true}, contextPerRecipient: { 'foo.bar@gmail.com': {'foo': true}, 'fulano@gmail.com.br': {'bar': true} }, useTplDefaultSubject: true, useTplDefaultEmail: false, useTplDefaultName: false }); var client = new MittePro.Client('<your_account_public_key>', '<your_account_secret_key>'); client.sendTemplate(templateMail).then(function (result) { console.log(result); }, function (error) { console.log(error); });