POST /api/v1/smtp-mailer/auth HTTP/1.1
Host: yudha.id
Content-Type: application/json
{
    "smtp_username": "user@example.com",
    "smtp_password": "smtppassword"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
    "code": 200,
    "data": {
        "not_after": "2024-09-21 02:33:10.497143085 UTC",
        "token": "eyJ0eXAiOiJKV..."
    }
}
POST /api/v1/smtp-mailer HTTP/1.1
Host: yudha.id
Content-Type: application/json
Authorization: Bearer ...
{
    "smtp_host": "smtp.example.com",
    "smtp_port": 587,
    "use_tls": true,
    "from": {
        "email": "user@example.com",
        "name": "User Example"
    },
    "to": [
        {
            "email": "recipient1@example.com",
            "name": "Recipient 1 Name"
        },
        {
            "email": "recipient2@example.net"
        }
    ],
    "subject": "Subject SMTP Mailer",
    "body": {
        "text": "Hello world!",
        "html": "<h1>Hello \"world\"!</h1>"
    }
}
HTTP/1.1 200 OK
Content-Type: application/json
{
    "code": 200,
    "data": [
        {
            "email": "recipient1@example.com",
            "msg": "Email sent successfully!",
            "name": "Recipient 1 Name",
            "status": "success"
        },
        {
            "email": "recipient2@example.net",
            "msg": "Email sent successfully!",
            "status": "success"
        }
    ]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
    "code": 400,
    "msg": "Only 3 email recipients are allowed"
}
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
    "code": 401,
    "msg": "invalid token"
}

stats . copyright © Yudha Rachmat Hidayat
2017 - 2024