Send Email

Resource type: sendmail

With this API call an email can be sent analogously to the mail composer in onOffice enterprise. If the email contains macros, they will be replaced by address data (receiver) and estate data (estateids). All types of file attachments can also be sent.

The mailbox through which the email is sent must be assigned to the API user. You can define the assignment in the e-mail administration under “Extras -> Settings -> Basic Settings -> Email”.

Parameters:

  • emailidentity
    STRING. MANDATORY. Identity under whose name the emails should be sent. Can only accept identities associated with the user in enterprise.
  • receiver
    ARRAY. MANDATORY. Receiver of the email. Both valid email addresses and database IDs of enterprise addresses can be applied here. Must contain at least one valid element.
  • cc
    ARRAY. Copy receiver of the email. Both valid email addresses and database IDs of enterprise addresses can be applied here.
  • bcc
    ARRAY. Blind copy receiver of the email. Both valid email addresses and database IDs of enterprise addresses can be transferred here.
  • displayName
    STRING. Display name. The display name is an addition to a sender mail address that is displayed to the recipient of an e-mail instead of the sender mail address.
  • subject
    STRING. Email subject.
  • body
    STRING. Email content. Ignored if templateid has a valid value.
  • templateid
    INTEGER. ID of an email template stored in enterprise. It is prioritized over the email content. The possible identifiers can be queried via Email & PDF exposé templates.
  • replyto
    STRING. Email address for email reply.
  • estateids
    ARRAY. Database IDs of estates in enterprise.
  • useHtml
    BOOLEAN. Mail is sent as html if true, otherwise as text.
  • pdfexposeidentifiers
    ARRAY. Identifiers for PDF exposés. The possible identifiers can be queried via Get templates.
  • pdfletterids
    ARRAY. IDs of the PDF letters sent as attachments. The possible IDs can be queried via Get templates. The IDs of mail template attachments can be queried via the API call Default attachments.

    Note: Exposes can be attached to PDF letters in enterprise. These attachments of PDF letters are not sent via API. If required, these can be added explicitly in the API call via the pdfexposeids parameter. If an exposé is attached to the e-mail and mergeexposeintopdfletter is set to true, a maximum of one PDF letter can be attached.

  • pdfformids
    ARRAY. IDs of the PDF forms sent as attachments. The possible IDs can be queried via Get templates. The IDs of mail template attachments can be queried via the API call Default attachments.
  • documentattributes
    ARRAY. Field names of the document attributes. The possible identifiers can be queried via Field Configuration with module file.
  • onlineattachmentids
    ARRAY. The IDs of the estate files from the files tab. The IDs can be queried via Estate files. Files of the file type link can also be sent.
  • mergeexposeintopdfletter
    BOOLEAN. Exposé and PDF letter attachments are merged into one document and sent as one attachment file. If an exposé is attached to the email and mergeexposeintopdfletter is set to true, a maximum of one PDF letter can be attached. Default: false.

1st example: Send mail from mail template

...
{
    "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:do",
    "resourceid": "",
    "identifier": "",
    "resourcetype": "sendmail",
    "parameters": {
        "emailidentity": "max.mustermann@my-onoffice.de",
        "templateid": 1211,
        "useHtml": true,
        "receiver": [
            "marie.musterfrau@onoffice.de"
        ]
    }
}
...

2nd example: Send mail with attachments (here exposes)

...
    {
        "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:do",
        "resourceid": "",
        "identifier": "",
        "resourcetype": "sendmail",
        "parameters": {
            "emailidentity": "sender@myonoffice.de",
            "body": "message of the mail",
            "subject": "subject of the mail",
            "pdfexposeidentifiers": [
                "urn:onoffice-de-ns:smart:2.5:pdf:expose:lang:Expos\u00e9 Electra",
                "urn:onoffice-de-ns:smart:2.5:pdf:expose:lang:Expos\u00e9 Gable"
            ],
            "estateids": [
                12,
                23
            ],
            "receiver": [
                "receicer@onoffice.de"
            ]
        }
    }
...