No no, if you already have a working analysis run setup, you need to modify your code a little bit. I assume you already have a working SMTP server or mailing service.
For example, following the preset example script that generates a .pdf file and sends it via mail:
const { Analysis, Device, Services, Utils } = require("@tago-io/sdk");const envVars = Utils.envToJson(context.environment);// Start the email serviceconst emailService = new Services({ token: context.token }).email;// Send the email.await emailService.send({ to: envVars.email, subject: "Exported File from TagoIO", message: "This is an example of a body message", attachment: { archive: pdf_base64.result, type: "base64", filename: "exportedfile.pdf", },});
You need to set up your SMTP credentials in the ‘Secrets’ sections of your TagoIO account, and then enable the secret in the ‘Access’ module, giving permission to all your scripts that needed these credentials.
Then, in your script, you need to access your SMTP credentials (in the environment), change the method of your mailService, and add your credentials in the object.
const { Analysis, Device, Services, Utils } = require("@tago-io/sdk");const envVars = Utils.envToJson(context.environment);// Start the email serviceconst emailService = new Services({ token: context.token }).smtp;// Send the email.await emailService.send({ from: "account@your-mail.com", smtp_secret: envVars.YOUR_SMTP_SECRET, to: envVars.email, subject: "Exported File from TagoIO", message: "This is an example of a body message", attachment: { archive: pdf_base64.result, type: "base64", filename: "exportedfile.pdf", },});
I noted that with the new .smtp method you need to specify also your ‘from’ parameter, so you need a working mail (but perhaps it’s a skill issue on my end).