Giter Club home page Giter Club logo

Comments (3)

arnaudbreton avatar arnaudbreton commented on July 17, 2024

Hi @AyKarsi,

Congrats for being the first to open an issue here :)!
The following code will let you achieve what you want:

// Don't forget to set them in your environment vars or change them with your API credentials directly
var mailjet = require ('node-mailjet')
    .connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)

var request = mailjet
    .post("send")
    .request({
        "FromEmail":"[email protected]",
        "FromName":"Mailjet Pilot",
        "Subject":"Your email flight plan!",
        "Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
        "Html-part":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
        "Recipients":[{"Email":"[email protected]"}],
        "Attachments":[{"Content-type":"text/plain","Filename":"test.txt","content":"VGhpcyBpcyB5b3VyIGF0dGFjaGVkIGZpbGUhISEK"}]
    });

request
    .on('success', function (response, body) {
        console.log (response.statusCode, body);
    })
    .on('error', function (err, response) {
        console.log (response.statusCode, err);
    });

A coming version of our API documentation will contain such events.

Hope it works for you!
Arnaud.

from mailjet-apiv3-nodejs.

arnaudbreton avatar arnaudbreton commented on July 17, 2024

Hey @AyKarsi,

If that solved your issue, could you please close this issue?
Any further questions, don't hesitate.

Best,
Arnaud.

from mailjet-apiv3-nodejs.

AyKarsi avatar AyKarsi commented on July 17, 2024

thanks!

from mailjet-apiv3-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.