Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shimondoodkin/nodejs-phpmailer
Don't laugh it works. It enables to send emails with phpmailer from nodejs.
https://github.com/shimondoodkin/nodejs-phpmailer
Last synced: 28 days ago
JSON representation
Don't laugh it works. It enables to send emails with phpmailer from nodejs.
- Host: GitHub
- URL: https://github.com/shimondoodkin/nodejs-phpmailer
- Owner: shimondoodkin
- Created: 2010-12-02T20:21:01.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2010-12-02T20:37:17.000Z (about 14 years ago)
- Last Synced: 2024-10-19T22:51:40.136Z (2 months ago)
- Homepage:
- Size: 191 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##nodejs-phpmailer
At the moment there is no mime encoding email module for node js.
I wanted to send beutiful registration emails with inline images.So I did some integration.
It is not good for frequent emailing. Because it might be slow.
also php5-cli should be installed.
//how to use:
var phpmailer=require('nodejs-phpmailer');
// defaults for gmail
phpmailer.options={
"IsSMTP":true,
"SMTPSecure":"ssl",
"Host":"smtp.gmail.com",
"Port":465,
"SMTPAuth":true,
"Username":"[email protected]",
"Password":"********",
"From":"[email protected]",
"FromName":"My site's mailer",
"Sender":"[email protected]",
//"AddReplyTo":[{"email":"[email protected]","name":"Replies for my site Doodkin"}],
//"AddAddress":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
//"AddCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
//"AddBCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"IsHTML":true,
"AutoImages":true,
"AutoImagesPath":__dirname."/images/",
};
//or
// defaults for localhost
phpmailer.options={
"IsSMTP":true,
//"SMTPSecure":"ssl",
"Host":"localhost",
"Port":25,
//"SMTPAuth":true,
//"Username":"[email protected]",
//"Password":"********",
"From":"[email protected]",
"FromName":"My site's mailer",
"Sender":"[email protected]",
//"AddReplyTo":[{"email":"[email protected]","name":"Replies for my site Doodkin"}],
//"AddAddress":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
//"AddCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
//"AddBCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"IsHTML":true,
"AutoImages":true,
"AutoImagesPath":__dirname."/images/",
};send example:
phpmailer.send({
"AddReplyTo":[{"email":"[email protected]","name":"Replies for my site Doodkin"}],
"AddAddress":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"AddCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"AddBCC":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"Subject":"Test 1 Subject",
"Body":"Test 1 of PHPMailer html
sadfasdfasdfThis is a test picture:
",
"AltBody":"Test 1 Alt Body",
"AddAttachment":
[
{
"path":"/home/someone/www/dev.username/deps/nodejs-phpemail/PHPMailer_v5.1/examples/images/phpmailer_mini.gif",
"name":"phpmailer.gif"
}
]
});simple html send example:
phpmailer.send({
"AddAddress":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"Subject":"Test 1 Subject",
"Body":"Test 1 of PHPMailer html
sadfasdfasdfThis is a test picture:
",
"AltBody":"Test 1 Alt Body",
"AddAttachment":
[
{
"path":"/home/someone/www/dev.username/deps/nodejs-phpemail/PHPMailer_v5.1/examples/images/phpmailer_mini.gif",
"name":"phpmailer.gif"
}
]
});simple text send example:
phpmailer.send({
"AddAddress":[{"email":"[email protected]","name":"Replies for my site Helpmepro1"}],
"Subject":"Test 1 Subject",
"IsHTML":false,
"Body":"Test text Body",
"AddAttachment":
[
{
"path":"/home/someone/www/dev.username/deps/nodejs-phpemail/PHPMailer_v5.1/examples/images/phpmailer_mini.gif",
"name":"phpmailer.gif"
}
]
});simpler text send example:
phpmailer.send({
"AddAddress":["[email protected]"],
"Subject":"Test 1 Subject",
"Body":"Test text Body",
"IsHTML":false,
});AddAddress,AddReplyTo,AddCC,AddBCC are arrays of objects like
{
"email":"[email protected]",
"name":"Recipient name"
}
or
"[email protected]"
So it could be an object with properties or a string.
if "AutoImages" is true then it searches for img tags and for background tags
and replaces them with cid and adds an item to AddEmbeddedImage with AutoImagesPath.
AddEmbeddedImage is an array of objects like{
"path":__dirname."/phpmailer.gif",
"cid":"logoimg"
}
AddAttachment is an array of objects like{
"path":__dirname."/phpmailer_mini.gif",
"name":"phpmailer_mini.gif"
}Also you could use a template engine to generate the html = )