Send Messages

    Sends a message.

    Caution

    • An email subject can be up to 100 characters in length; if it is longer than that, only the first 100 characters are stored.
    • Before a message is sent, the API only checks whether the To address of a message is correctly formed; it does not check whether the address is valid (whether it can receive a message, whether it exists, etc.).
    • If the address is not valid, "[Message delivery failed]" message is sent to the sender.
    • If a message contains a file with a blocked extension or a virus-infected file as an attachment, the delivery of the message will fail.
    • If a file with a blocked extension or a virus-infected file is uploaded as an attachment, the error message, FILE_UPLOAD_REJECT_VIRUS or FILE_UPLOAD_BLOCKED, is displayed with the blocked file name.
    • A file of up to 20 MB can be attached. (The maximum size of an attachment can be set by the admin.)
    • If a file over 20 MB is attached, SYSTEM_ERROR occurs.

    API Type

    Service API

    Request URL

    https://apis.worksmobile.com/r/{API ID}/mail/v2/sendMail

    HTTP Method

    POST(Content-Type: multipart/form-data; boundary="$boundary”; charset=UTF-8)

    Request

    Parameter Type Required Description
    userName String N Sender name
    to String Y The email addresses of to-recipients; each address is separated by a semicolon (;).
    Example) admin@example.com; admin1@example.com
    cc String N The email addresses of cc-recipients; each address is separated by a semicolon (;).
    Example) admin@example.com; admin1@example.com
    bcc String N The email addresses of bcc-recipients; each address is separated by a semicolon (;).
    Example) admin@example.com; admin1@example.com
    subject String Y Message subject
    A subject can be up to 100 characters in length; if it is longer than that, only the first 100 characters are stored.
    text String N Message content
    contentType String N Message content type
    ● html (default)BR>● text (text message)
    saveSentMail String N Indicates whether to save the message in Sent Mail.
    ● true (default)
    ● false
    sendSeparately String N Indicates whether to send an individual message to each recipient.
    ● true
    ● false (default)
    attachment name Multipart N Name of the UTF-8 encoded attachment
    • Specify the name of the file to upload as attachment name. Example) If you attach file.text, specify file.text as attachment name.
    • A new line character differs depending on the message body type. In HTML it is '\', and in TEXT, it is '\r\n' (carriage return and line feed) in case of server calls in Java, and “Enter (line feed)” in case of client calls using a browser and others, passing the message body using text or textarea in HTML.

    Response

    It returns HTTP status 200 with response data in JSON format if the API call is successful.

    Property Type Required Description
    smtpFailList List Y List of email addresses which cannot be sent due to the SMTP error
    Example) nvmail051@example.com, nvmail052@example.com
    successList List Y List of email addresses which has been successfully sent
    Example) nvmail051@example.com, nvmail052@example.com
    dupAddrList List Y List of email addresses which are added more than once (not an error)
    Example) nvmail051@example.com, nvmail052@example.com
    dormantAddrList List Y List of dormant email addresses
    Example) nvmail051@example.com, nvmail052@example.com
    noneExistenceAddrList List Y List of email addresses which does not exist
    Example) nvmail051@example.com, nvmail052@example.com
    wrongAddrList List Y List of wrong email addresses
    Example) nvmail051@example.com, nvmail052@example.com

    Response Example

    {
        "returnCode": 0,
        "successList": ["nvmail051@example.com", "nvmail052@example.com"],
        "wrongAddrList": [],
        "noneExistenceAddrList": [],
        "smtpFailList": [],
        "returnMessage": 0,
        "dormantAddrList": [],
        "dupAddrList": []
    }
    

    Error

    It returns an error code and message with HTTP status when the API call fails.

    Property Type Description
    code String Error code
    message String Error message
    HTTP status Error code Description
    400 INVALID_PARAMETER Invalid request parameters
    500 SYSTEM_ERROR Internal server error
    Error Example
    {
        "code": "INVALID_PARAMETER",
        "message": "FILE_UPLOAD_REJECT_VIRUS : virus.exe",
        "domain": "mail"
    }