1.10.1 • Published 4 years ago

mittepro-js v1.10.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

mittepro-js

Client service, to send simple text emails or, using a template created at MittePro, send more complex emails.

In order to use this library, you must create an account in MittePro.

** It is not currently possible to create an account in MittePro, but will soon be **

How to install:

npm install mittepro-js

Follow the examples below to send simple emails or emails with templates:

Simple Emails:

'use strict';

var MittePro = require('mittepro-js');

var textMail = new MittePro.Mail({
    recipientList: ['Foo Bar <foo.bar@mail.com>', 'Fulano Aquino <fulano@mail.com>', '<ciclano@mail.com>'],
    messageText: 'Simple text message.',
    from: 'Beutrano <beutrano@mail.com>',
    subject: 'Just a test - Sended From Client'
});
var client = new MittePro.Client('<your_account_public_key>', '<your_account_secret_key>');
client.send(textMail).then(function (result) {
    console.log(result);
}, function (error) {
    console.log(error);
});

Template Emails:

'use strict';

var MittePro = require('mittepro-js');

var templateMail = new MittePro.Mail({
    recipientList: ['Foo Bar <foo.bar@mail.com>', 'Fulano Aquino <fulano@mail.com>', '<ciclano@mail.com>'],
    from: 'Beutrano <beutrano@mail.com>',
    templateSlug: 'test-101',
    context: {'foobar': true},
    contextPerRecipient: {
        'foo.bar@gmail.com': {'foo': true},
        'fulano.arquino@gmail.com.br': {'bar': true}
    },
    useTplDefaultSubject: true,
    useTplDefaultEmail: false,
    useTplDefaultName: false

});
var client = new MittePro.Client('<your_account_public_key>', '<your_account_secret_key>');
client.sendTemplate(templateMail).then(function (result) {
    console.log(result);
}, function (error) {
    console.log(error);
});

Mail Parameters:

ParameterTypeRequiredDescription
recipientListListYesList of all the recipients. The expected format is 'Name <email>' or '<email>'.
subjectStringYes*The subject of the email. *In case your sending an email with template and pass useTplDefaultSubject as true then you don't need to pass the subject.
messageTextStringYes*The message of the email on text format. *Only Required if your gonna send a simple text email.
messageHtmlStringNoThe message of the email on html format. *If pass this then you don't need to pass the templateSlug.
tagsDict/ListNoThe tags must be an dictionary containing keys and simple values or an list with strings.
fromStringNo*The email of the sender. The expected format is 'Name <email>' or '<email>'. *In case your sending an email with template and pass use_template_email as true then you don't need to pass this parameter.
templateSlugStringNoThe templateSlug is the slug of the template. *Just pass this if your gonna send a email with template.
useTplDefaultNameBoolNo*If set to true it use the default value set to the sender's name.
useTplDefaultEmailBoolNo*If set to true it use the default value set to the sender's email.
useTplDefaultSubjectBoolNo*If set to true it use the default value set to the subject.
getTextFromHtmlBoolNo*If set to true mittepro will extract from your html template an text version. This will only happen if your template doesn't already have an text version.
activateTrackingBoolNo*If set to true mittepro will track if your email will be open and how many times. Also it will track any links clicked inside the email.
contextDictNoGlobal variables use in the Template. The format is expressed in the example (above).
contextPerRecipientDictNoVariables set for each recipient. The format is expressed in the example (above).

Client Parameters:

ParameterTypeRequiredDescription
keyStringYesYour account's public key in the MittePro.
secretStringYesYour account's private key in the MittePro.
1.10.1

4 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.8

5 years ago

1.8.7

5 years ago

1.8.6

5 years ago

1.8.5

6 years ago

1.8.4

6 years ago

1.8.3

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.8

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago