Is there a way to attach a file from the Notifcation? #401
jackhuangca
started this conversation in
General
Replies: 1 comment
-
It's not a built-in option. It shouldn't be hard to implement this, depends on what you want to send. Do you want to attach logs or some specific file? echo '{ "chain": "ekkqcopde2a", "chain_data": { "custom_key": "foobar", "value": 42 } }' #!/usr/bin/env node
let stdin = JSON.parse(require("fs").readFileSync(0));
// stdin will contain some info about the job that is chaining this notification
const PixlMail = require('/opt/cronicle/node_modules/pixl-mail');
const mail = new PixlMail( 'mailrelay.cronicle.com', 25 );
// mail.setOption( 'secure', true ); // use ssl
// mail.setOption( 'auth', { user: 'fsmith', pass: '12345' } );
let body = `
Exit code: [chain_code]
Description: [chain_description]
Data: [chain_data]
`
let message =
"To: [email protected]\n" +
"From: [email protected]\n" +
"Subject: [source] failed\n" +
"\n" + body + "\n" ;
stdin.attachments = [ {filename: "osinfo.txt", path: "/etc/os-release"} ];
//stdin.attachments = [ {filename: "info.txt", content: JSON.stringify(stdin.chain_data)} ];
mail.send( message, stdin, function(err) {
if (err) return console.log( "Mail Error: " + err );
console.log("message sent");
} ); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to attach a file from the Notifcation?
Beta Was this translation helpful? Give feedback.
All reactions