mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
Adding nodemailer-mailgun-transport definitions (#18584)
* Adding diacritics package * Adding linter * Fixing linting errors * Fixing warnings and errors * Removing unnecessary namespace * Adding nodemailer-mailgun-transport definitions * Updating tsconfig.json * Updating tests
This commit is contained in:
committed by
Mohamed Hegazy
parent
48c8449d4b
commit
babd09c3ec
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for nodemailer-mailgun-transport 1.3
|
||||
// Project: https://github.com/orliesaurus/nodemailer-mailgun-transport
|
||||
// Definitions by: Oto Ciulis <https://github.com/otociulis/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as nodemailer from 'nodemailer';
|
||||
|
||||
declare namespace mailgunTransport {
|
||||
interface AuthOptions {
|
||||
api_key: string;
|
||||
domain?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function mailgunTransport(options: mailgunTransport.AuthOptions): nodemailer.Transport;
|
||||
|
||||
export = mailgunTransport;
|
||||
@@ -0,0 +1,25 @@
|
||||
import mailgunTransport = require('nodemailer-mailgun-transport');
|
||||
import nodemailer = require('nodemailer');
|
||||
|
||||
const opts: mailgunTransport.AuthOptions = {
|
||||
api_key: "harry"
|
||||
};
|
||||
|
||||
const optsWithDomain: mailgunTransport.AuthOptions = {
|
||||
api_key: "harry",
|
||||
domain: "http://www.foo.com"
|
||||
};
|
||||
|
||||
const transport: nodemailer.Transporter = nodemailer.createTransport(mailgunTransport(optsWithDomain));
|
||||
|
||||
// setup e-mail data with unicode symbols
|
||||
const mailOptions: nodemailer.SendMailOptions = {
|
||||
from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address
|
||||
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
|
||||
subject: 'Hello ✔', // Subject line
|
||||
text: 'Hello world ✔', // plaintext body
|
||||
html: '<b>Hello world ✔</b>' // html body
|
||||
};
|
||||
transport.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => {
|
||||
// nothing
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"nodemailer-mailgun-transport-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user