socketlabs / socketlabs-nodejs Goto Github PK
View Code? Open in Web Editor NEWSocketLabs Email Delivery Node.js client library
Home Page: https://www.socketlabs.com
License: MIT License
SocketLabs Email Delivery Node.js client library
Home Page: https://www.socketlabs.com
License: MIT License
From the documentation examples:
//Many different ways to add recipients
message.to.push("[email protected]");
message.to.push(new EmailAddress("[email protected]"));
message.to.push(new EmailAddress("[email protected]", { friendlyName: "Recipient #3" }));
message.to.push({ emailAddress: "[email protected]" });
message.to.push({ emailAddress: "[email protected]", friendlyName: "Recipient #5" });
i understand that for every email i have these many options to use, but for the given case of the replyTo field if i try to use the object definition directly:
replyTo: { emailAddress: data.replyTo.emailAddress }
it throws the following error:
2022-05-27T09:48:39.363Z bee95426-8d19-5c27-b788-0f2c2db3636d ERROR Invoke Error {"errorType":"TypeError","errorMessage":"this.replyTo.toJSON is not a function","stack":["TypeError: this.replyTo.toJSON is not a function"," at e.exports.toJSON (/var/task/src/main/js/index.js:2:18636)"," at /var/task/src/main/js/index.js:2:3417"," at new Promise (<anonymous>)"," at Object.generateRequest (/var/task/src/main/js/index.js:2:2703)"," at /var/task/src/main/js/index.js:2:34672"," at new Promise (<anonymous>)"," at SocketLabsClient.send (/var/task/src/main/js/index.js:2:34552)"," at /var/task/src/main/js/index.js:2:473415"," at processTicksAndRejections (internal/process/task_queues.js:95:5)"," at async Runtime.e.exports.handler (/var/task/src/main/js/index.js:2:471749)"]}
I had to import the EmailAddress class to avoid the error. I believe since the documentation states that the declaration can be done differently there's something to be addressed.
Thanks
PD: i have other emails in the message other than the replyTo declared the same way and they work properly.
Hi,
according to the code
toAttachment.convert
should return an attachment instance with "toJSON" function, however we got only the second object and it failed on toJSON call, you can see the example below:
line 50 in file toAttachment.js
return new attachment(), {
name: n,
content: c,
contentType: t,
customHeaders: h,
filePath: f,
contentId: i
};
so if we will change the code to run the constructor properly it works like it should be:
return new attachment( {
name: n,
content: c,
contentType: t,
customHeaders: h,
filePath: f,
contentId: i
});
Thank you,
Moria
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.