Conta de email

Listar contas de email

API de listagem das contas de email.

GET /api/email/accounts

Exemplo de requisição

GET /api/email/accounts HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.email.get_accounts()
print(response.payload)
const response = await sdk.email.getAccounts();
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "id": 1,
    "default": true,
    "name": "Contas envio de certificados",
    "email": "certs@itflex.com.br",
    "service": "gmail",
    "hash_auth": true,
    "password": "certs",
    "smtp_server": "smtp.test.com.br",
    "smtp_port": 1000,
    "smtp_crypt": "ssl-tls",
    "smtp_auth_mechanism": "plain",
    "created_at": "2018-12-13T12:20:02.932000+00:00",
    "updated_at": "2018-12-13T12:20:02.932000+00:00"
  },
]
[
    Account(
        id=1,
        default=True,
        name="Contas envio de certificados",
        email="certs@itflex.com.br",
        service="gmail",
        hash_auth=True,
        password="certs",
        smtp_server="smtp.test.com.br",
        smtp_port=1000,
        smtp_crypt="ssl-tls",
        smtp_auth_mechanism="plain",
        created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
        updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
    )
]
[
  {
    id: 1,
    default: true,
    name: "Contas envio de certificados",
    email: "certs@itflex.com.br",
    service: "gmail",
    hashAuth: true,
    password: "certs",
    smtpServer: "smtp.test.com.br",
    smtpPort: 1000,
    smtpCrypt: "ssl-tls",
    smtpAuthMechanism: "plain",
    createdAt: "2018-12-13T12:20:02.000Z",
    updatedAt: "2018-12-13T12:20:02.000Z"
  }
];

Buscar conta de email

API de consulta de conta de email

GET /api/email/accounts/id

Exemplo de requisição

GET /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.email.types import GetAccountRequest

request = GetAccountRequest(id=1)

response = sdk.email.get_account(request)
print(response.payload)
const response = sdk.email.getAccount({ id: 1 });
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
  "created_at": "2018-12-13T12:20:02.932000+00:00",
  "updated_at": "2018-12-13T12:20:02.932000+00:00"
}
Account(
    id=1,
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
    created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
    updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
  id: 1,
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain",
  createdAt: "2018-12-13T12:20:02.000Z",
  updatedAt: "2018-12-13T12:20:02.000Z"
}

Criar conta de email

API para criação de conta e email

POST /api/email/accounts

Exemplo de requisição

POST /api/email/accounts HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
}
from itflex_sdk.email.types import CreateAccountRequest

request = CreateAccountRequest(
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
)

response = sdk.email.create_account(request)
print(response.payload)
const response = await sdk.email.createAccount({
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain"
});
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
  "created_at": "2018-12-13T12:20:02.932000+00:00",
  "updated_at": "2018-12-13T12:20:02.932000+00:00"
}
Account(
    id=1,
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
    created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
    updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
  id: 1,
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain",
  createdAt: "2018-12-13T12:20:02.000Z",
  updatedAt: "2018-12-13T12:20:02.000Z"
}

Editar uma conta de email

API de edição de conta de email.

PUT /api/email/accounts/id

Exemplo de requisição

PUT /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
}
from itflex_sdk.email.types import UpdateAccountRequest

request = UpdateAccountRequest(
    id=1,
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
)

response = sdk.email.update_account(request)
print(response.payload)
const response = await sdk.email.updateAccount({
  id: 1,
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain"
});
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
  "created_at": "2018-12-13T12:20:02.000Z",
  "updated_at": "2018-12-13T12:20:02.000Z"
}
Account(
    id=1,
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
    created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
    updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
  id: 1,
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain",
  createdAt: "2018-12-13T12:20:02.000Z",
  updatedAt: "2018-12-13T12:20:02.000Z"
}

Deletar uma conta de email

API de deleção de conta de email.

DELETE /api/email/accounts/id

Exemplo de requisição

DELETE /api/email/accounts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.email.types import DeleteAccountRequest

request = DeleteAccountRequest(id=1)

response = sdk.email.delete_account(request)
print(response.success)
const response = await sdk.email.deleteAccount({ id: 1 });
console.log(response.success);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json
True
true;

Teste de envio de email

API para testa envio de email

POST /api/email/accounts/test

Exemplo de requisição

POST /api/email/accounts/test HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "default": true,
  "name": "Contas envio de certificados",
  "email": "certs@itflex.com.br",
  "service": "gmail",
  "hash_auth": true,
  "password": "certs",
  "smtp_server": "smtp.test.com.br",
  "smtp_port": 1000,
  "smtp_crypt": "ssl-tls",
  "smtp_auth_mechanism": "plain",
  "to_email": "test@test.com",
}
from itflex_sdk.email.types import TestAccountRequest

request = TestAccountRequest(
    default=True,
    name="Contas envio de certificados",
    email="certs@itflex.com.br",
    service="gmail",
    hash_auth=True,
    password="certs",
    smtp_server="smtp.test.com.br",
    smtp_port=1000,
    smtp_crypt="ssl-tls",
    smtp_auth_mechanism="plain",
    to_email="test@test.com"
)

response = sdk.email.teste_account(request)
print(response.payload)
const response = await sdk.email.testAccount({
  default: true,
  name: "Contas envio de certificados",
  email: "certs@itflex.com.br",
  service: "gmail",
  hashAuth: true,
  password: "certs",
  smtpServer: "smtp.test.com.br",
  smtpPort: 1000,
  smtpCrypt: "ssl-tls",
  smtpAuthMechanism: "plain",
  toEmail="test@test.com"
});
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK

Formato dos dados

Resposta

Campo Descrição
id int

Identificador da conta de email

default booleanrequerido

Flag se a conta de email é a conta padrão do sistema

name stringrequerido

Nome da conta de email

email stringrequerido

Email da conta

service stringrequerido

Tipo de serviço de email que deve ser utilizado

Valores possíveis:

  • gmail
  • outlook
  • other
has_auth booleanrequerido

Flag se a conta tem autenticação

password string

Senha de usuário de autenticação no servidor email

smtp_server string

Endereço do servidor SMTP para envio de emails

smtp_crypt string

Tipo de criptografia do servidor de envio de email

Valores possíveis:

  • none
  • ssl-tls
  • starttls
smtp_auth_mechanism string

Mecanismo de autenticação por usuário e senha do servidor de envio de email.

Valores possíveis:

  • plain
  • login
  • cram-md5