Sending email notifications
- Last updated on December 29, 2023
- •
- 1 minute to read
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.
flowchart TB
t1(Getting a design)
t2(Rendering the design)
t3(Sending email)
t4(Finalizing)
t1--design-->t2
t2--print file-->t3
t3-->t4
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.0.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>• <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.