Sign inSign up

telminov/email-service

By telminov

Updated about 9 years ago

Microservice django-project for sw-python-email-devino library.

Image
0

1.4K

telminov/email-service repository overview

email-service

Microservice django-project for sw-python-email-devino library.

Example send bulk

Service authentication

Session authentication or token authentication (http://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication)

Add sender address in Devino.

After adding the sender's address, you need to contact the Devino manager to confirm the address

import requests
data = {
    'address': '[email protected]'
}
requests.post('http://127.0.0.1:8000/api/add_address_sender/', json=data, headers={'Authorization': 'Token ...'})
Get exists addresses
import requests
response = requests.get('http://127.0.0.1:8000/api/get_addresses_sender/',
                        headers={'Authorization': 'Token ...'})
response.json()
{'code': 'ok',
 'description': 'ok',
 'result': [{'Confirmed': True, 'SenderAddress': '[email protected]'}]}


Send one message to email
import requests

data = {
    'recipient_email': '[email protected]',
    'recipient_name': 'Test name',
    'sender_email': '[email protected]', 
    'sender_name': 'Other test name', 
    'subject': 'Test subj', 
    'text': 'Test text', 
}

response = requests.post('http://127.0.0.1:8000/api/send_message/', json=data, headers={'Authorization': 'Token ...'})
response.json()
Send message to exists contacts
import requests

data = {
    'name': 'Test name',
    'sender_email': '[email protected]',
    'sender_name': 'Other test name',
    'subject': 'Test subj',
    'text': 'Test text',
    'start': '07/15/2100 16:00',
    'contact_list': [[559446, True]],   # id contact group and boolean value include or not include a group in the bulk
}

requests.post('http://127.0.0.1:8000/api/add_task/', json=data, headers={'Authorization': 'Token ...'})

Tag summary

Content type

Image

Digest

Size

247.8 MB

Last updated

about 9 years ago

docker pull telminov/email-service