Skip to main content

Sending email notifications

This example describes how you can render the ordered product and send an email notification with links to the resulting print files.

First, let's split our goal into simple operations from getting a design from the project to cleaning up the pipeline and updating the project.

These operations are performed using the following tasks:

{
"tasks": [
{
"description": "Extract design from project",
"name": "extract",
"type": "extract-project-design",
"parameters": {},
"outputArtifacts": [
"design"
]
},
{
"description": "Render design",
"name": "render-hires",
"type": "render-hires",
"inputArtifacts": [
"design"
],
"parameters": {
"hiResOutputDpi": 300,
"hiResOutputFileFormat": "pdf",
"hiResOutputColorSpace": "cmyk",
"hiResOutputToSeparateFiles": false,
"hiResOutputChannelContainersToSeparateFiles": false,
"hiResOutputChannelContainersRenderEmptyPage": true,
"hiResOutputCompression": "Jpeg",
"hiResOutputJpegCompressionQuality": 90
},
"outputArtifacts": [
"result"
]
},
{
"description": "Send link to print file by email",
"name": "send-email",
"type": "send-email",
"inputArtifacts": [ "result" ],
"parameters": {
"host": "your-company-smtp-server.com",
"port": 587,
"account": "noreply@your-company.com",
"username": "noreply@your-company.com",
"password": "your-secret-password",
"useSsl": true,
"recipients": "first@example.com, another@example.com",
"subject": "Your print file {{project.items.@.fields.customName?}} is ready",
"body": "Greetings {{project.customerName}}. <br> You can download a print file for your personalized product here: <br> $$links$$ <br>",
"useHtmlBody" : true,
"bodyLinksItemTemplate" : "<span>&bull; <a href=\"$$url$$\">$$name$$</a></span><br>",
"bodyLinksItemNamePlaceholder" : "$$name$$",
"bodyLinksItemUrlPlaceholder" : "$$url$$",
"bodyLinksPlaceholder" : "$$links$$"
}
},
{
"description": "Finalize",
"name": "finalizing",
"type": "finalize",
"finalArtifacts": [
"result"
]
}
]
}

For the detailed description of this pipeline, refer to the tutorial How to create pipelines.

Was this page helpful?