Service Id: platform6.email
1. Send Email With Optional Attachments¶
| Header’s key | Description | Value | 
|---|---|---|
| platform6.request.action | The action to perform (required) | invoke | 
| profile.name | Email profile name to use for the request (optional) | |
| profile.appkey | Email profile appKey to use for the request (optional) | |
| from | Originator address | |
| to | Recipient address (required) | |
| replyto | Reply to address | |
| cc | Courtesy copy address | |
| bcc | Blind courtesy copy address | |
| subject | The email subject | 
Attachment of the common message
Zero or more attachments can be specified. Unless using the fileurl header the attachment content must be specified as bytes.
| Header key | Description | Value | 
|---|---|---|
| name | Used to identify the email body (required) | body | 
| type | MIME Types (required) | |
| filename | Name for attachment | |
| filenurl | The URL of a file to attach | 
A valid response will be:
| Header key | Description | Value(s) | 
|---|---|---|
| platform6.response.status | Email send success | OK | 
| platform6.response.value | Email send message | “n email(s) sent successfully” | 
Example¶
def cm = [
    headers: [
        'platform6.request.action': 'invoke',
        'from': 'myaccount@gmail.com',
        'to': 'simon.temple@amalto.com',
        'subject': 'Email Service Test'
    ],
    attachments: [
        [
            headers: [
                name: 'body',
                type: 'text/plain'
            ],
            bytes: 'This is email body content\n'.getBytes()
        ],
        [
            headers: [
                filename: 'hello.txt',
                type: 'text/plain'
            ],
            bytes: 'This is attachment content'.getBytes()
        ],
        [
            headers: [
                fileurl: 'file:///Volumes/Transcend/Downloads/logo.tiff'
            ]
        ]
    ]
]
def rcm = p6.service.request('platform6.email', cm)
if( rcm.headers['platform6.response.status'] == 'OK') {
    // Send successful
}
The response will be:
platform6.response.status: OK, platform6.response.value: 1 email(s) sent successfully 
2. Send Email Using the Pre-Prepared MIME Attachment¶
| Header’s key | Description | Value | 
|---|---|---|
| platform6.request.action | The action to perform (required) | invokeraw | 
| profile.name | Email profile name to use for the request (optional) | |
| profile.appkey | Email profile appKey to use for the request (optional) | |
| from | Originator address | |
| to | Recipient address (required) | |
| replyto | Reply to address | |
| cc | Courtesy copy address | |
| bcc | Blind courtesy copy address | |
| subject | The email subject | 
Attachment of the common message
Only one attachment can be specified and must contain a MIME message with content encoded as bytes.
| Header key | Description | Value | 
|---|---|---|
| [mime headers] | Raw headers transferred from teh message attachment into the email message | body | 
A valid response will be:
| Header key | Description | Value(s) | 
|---|---|---|
| platform6.response.status | Email send success | OK | 
| platform6.response.value | Email send message | “n email(s) sent successfully” |