

declare module "mailcomposer" {

	interface mailAddress {
		name: string;
		address: string;
	}
	interface mailcomposer {
		( mailcomposer: mailcomposerOption ): mailcomposer;
		build ( cb: ( err?, message? ) => void ): void;
		createReadStream: () => Stream.Readable;
	}
	interface mailcomposerOption {
		from?: string,
		to?: string[]
		subject?: string;
		text?: string| Buffer;
		textEncoding?: string;
		attachments?:attachments[];
		html?: string;
		alternatives?: attachments[];
		messageId?: string;
		date?: string;
	}
	interface attachments {
		filename?: string | boolean;
		content: string | Buffer| Stream.Readable;
		path?: string;  //stream this file or url https://raw.github.com/andris9/Nodemailer/master/LICENSE or as data:text/plain;base64,aGVsbG8gd29ybGQ=
		contentType?: string;       // text/plain
		encoding?: string;          // base64
		contentTransferEncoding?: string		//	quoted-printable, base64 
	}
	import * as Stream from 'stream'
	var ex: mailcomposer;
	export = ex;
}