mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
20
node_modules/nodemailer-smtp-transport/.jshintrc
generated
vendored
Normal file
20
node_modules/nodemailer-smtp-transport/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"indent": 4,
|
||||
"node": true,
|
||||
"globalstrict": true,
|
||||
"evil": true,
|
||||
"unused": true,
|
||||
"undef": true,
|
||||
"newcap": true,
|
||||
"esnext": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"expr": true,
|
||||
|
||||
"predef": [
|
||||
"describe",
|
||||
"it",
|
||||
"beforeEach",
|
||||
"afterEach"
|
||||
]
|
||||
}
|
||||
2
node_modules/nodemailer-smtp-transport/.npmignore
generated
vendored
Normal file
2
node_modules/nodemailer-smtp-transport/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.travis.yml
|
||||
test
|
||||
29
node_modules/nodemailer-smtp-transport/Gruntfile.js
generated
vendored
Normal file
29
node_modules/nodemailer-smtp-transport/Gruntfile.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
module.exports = function(grunt) {
|
||||
'use strict';
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
jshint: {
|
||||
all: ['src/*.js', 'test/*.js'],
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
}
|
||||
},
|
||||
|
||||
mochaTest: {
|
||||
all: {
|
||||
options: {
|
||||
reporter: 'spec'
|
||||
},
|
||||
src: ['test/*-test.js']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Load the plugin(s)
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-mocha-test');
|
||||
|
||||
// Tasks
|
||||
grunt.registerTask('default', ['jshint', 'mochaTest']);
|
||||
};
|
||||
19
node_modules/nodemailer-smtp-transport/LICENSE
generated
vendored
Normal file
19
node_modules/nodemailer-smtp-transport/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 Andris Reinman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
152
node_modules/nodemailer-smtp-transport/README.md
generated
vendored
Normal file
152
node_modules/nodemailer-smtp-transport/README.md
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
# SMTP transport module for Nodemailer
|
||||
|
||||
[](https://travis-ci.org/andris9/nodemailer-smtp-transport)
|
||||
[](http://badge.fury.io/js/nodemailer-smtp-transport)
|
||||
|
||||
Applies for Nodemailer v1.x and not for v0.x where transports are built-in.
|
||||
|
||||
## Setup
|
||||
|
||||
Install with npm
|
||||
|
||||
npm install nodemailer-smtp-transport
|
||||
|
||||
Require to your script
|
||||
|
||||
```javascript
|
||||
var nodemailer = require('nodemailer');
|
||||
var smtpTransport = require('nodemailer-smtp-transport');
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Create a Nodemailer transport object
|
||||
|
||||
```javascript
|
||||
var transporter = nodemailer.createTransport(smtpTransport(options))
|
||||
```
|
||||
|
||||
or (by using smtpTransport as default)
|
||||
|
||||
```javascript
|
||||
var transporter = nodemailer.createTransport(options)
|
||||
```
|
||||
|
||||
Where
|
||||
|
||||
* **options** defines connection data
|
||||
* **options.port** is the port to connect to (defaults to 25 or 465)
|
||||
* **options.host** is the hostname or IP address to connect to (defaults to 'localhost')
|
||||
* **options.secure** defines if the connection should use SSL (if `true`) or not (if `false`)
|
||||
* **options.auth** defines authentication data (see [authentication](#authentication) section below)
|
||||
* **options.ignoreTLS** turns off STARTTLS support if true
|
||||
* **options.name** optional hostname of the client, used for identifying to the server
|
||||
* **options.localAddress** is the local interface to bind to for network connections
|
||||
* **options.connectionTimeout** how many milliseconds to wait for the connection to establish
|
||||
* **options.greetingTimeout** how many milliseconds to wait for the greeting after connection is established
|
||||
* **options.socketTimeout** how many milliseconds of inactivity to allow
|
||||
* **options.debug** if true, the connection emits all traffic between client and server as 'log' events
|
||||
* **options.authMethod** defines preferred authentication method, eg. 'PLAIN'
|
||||
* **options.tls** defines additional options to be passed to the socket constructor, eg. *{rejectUnauthorized: true}*
|
||||
|
||||
Alternatively you can use connection url with protocol 'smtp:' or 'smtps:'. Use query arguments for additional configuration values.
|
||||
|
||||
**Example**
|
||||
|
||||
```javascript
|
||||
var transporter = nodemailer.createTransport(smtpTransport({
|
||||
host: 'localhost',
|
||||
port: 25,
|
||||
auth: {
|
||||
user: 'username',
|
||||
pass: 'password'
|
||||
}
|
||||
}));
|
||||
```
|
||||
|
||||
Or with connection url (gmail)
|
||||
|
||||
```javascript
|
||||
var transporter = nodemailer.createTransport(
|
||||
smtpTransport('smtps://username%40gmail.com:password@smtp.gmail.com')
|
||||
);
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
If authentication data is not present, the connection is considered authenticated from the start.
|
||||
|
||||
Set authentcation data with `options.auth`
|
||||
|
||||
Where
|
||||
|
||||
* **auth** is the authentication object
|
||||
* **auth.user** is the username
|
||||
* **auth.pass** is the password for the user
|
||||
* **auth.xoauth2** is the OAuth2 access token (preferred if both `pass` and `xoauth2` values are set) or an [XOAuth2](https://github.com/andris9/xoauth2) token generator object.
|
||||
|
||||
If a [XOAuth2](https://github.com/andris9/xoauth2) token generator is used as the value for `auth.xoauth2` then you do not need to set the value for `auth.user`. XOAuth2 generator generates required `accessToken` itself if it is missing or expired. In this case if the authentication fails, a new token is requested and the authentication is retried once. If it still fails, an error is returned.
|
||||
|
||||
Install xoauth2 module to use XOauth2 token generators (not included by default)
|
||||
|
||||
npm install xoauth2 --save
|
||||
|
||||
**XOAuth2 Example**
|
||||
|
||||
> **NB!** The correct OAuth2 scope for Gmail is `https://mail.google.com/`
|
||||
|
||||
```javascript
|
||||
var nodemailer = require('nodemailer');
|
||||
var generator = require('xoauth2').createXOAuth2Generator({
|
||||
user: '{username}',
|
||||
clientId: '{Client ID}',
|
||||
clientSecret: '{Client Secret}',
|
||||
refreshToken: '{refresh-token}',
|
||||
accessToken: '{cached access token}' // optional
|
||||
});
|
||||
|
||||
// listen for token updates
|
||||
// you probably want to store these to a db
|
||||
generator.on('token', function(token){
|
||||
console.log('New token for %s: %s', token.user, token.accessToken);
|
||||
});
|
||||
|
||||
// login
|
||||
var transporter = nodemailer.createTransport(({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
xoauth2: generator
|
||||
}
|
||||
}));
|
||||
|
||||
// send mail
|
||||
transporter.sendMail({
|
||||
from: 'sender@example.com',
|
||||
to: 'receiver@example.com',
|
||||
subject: 'hello world!',
|
||||
text: 'Authenticated with OAuth2'
|
||||
}, function(error, response) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
console.log('Message sent');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Using well-known services
|
||||
|
||||
If you do not want to specify the hostname, port and security settings for a well known service, you can use it by its name (case insensitive)
|
||||
|
||||
```javascript
|
||||
smtpTransport({
|
||||
service: 'gmail',
|
||||
auth: ..
|
||||
});
|
||||
```
|
||||
|
||||
See the list of all supported services [here](https://github.com/andris9/nodemailer-wellknown#supported-services).
|
||||
|
||||
## License
|
||||
|
||||
**MIT**
|
||||
87
node_modules/nodemailer-smtp-transport/package.json
generated
vendored
Normal file
87
node_modules/nodemailer-smtp-transport/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"nodemailer-smtp-transport@^1.1.0",
|
||||
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/nodemailer"
|
||||
]
|
||||
],
|
||||
"_from": "nodemailer-smtp-transport@>=1.1.0 <2.0.0",
|
||||
"_id": "nodemailer-smtp-transport@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/nodemailer-smtp-transport",
|
||||
"_nodeVersion": "5.3.0",
|
||||
"_npmUser": {
|
||||
"email": "andris@kreata.ee",
|
||||
"name": "andris"
|
||||
},
|
||||
"_npmVersion": "3.3.12",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "nodemailer-smtp-transport",
|
||||
"raw": "nodemailer-smtp-transport@^1.1.0",
|
||||
"rawSpec": "^1.1.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.1.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nodemailer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-1.1.0.tgz",
|
||||
"_shasum": "e6c37f31885ab3080e7ded3cf528c4ad7e691398",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "nodemailer-smtp-transport@^1.1.0",
|
||||
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/nodemailer",
|
||||
"author": {
|
||||
"name": "Andris Reinman"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/andris9/nodemailer-smtp-transport/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"clone": "^1.0.2",
|
||||
"nodemailer-wellknown": "^0.1.7",
|
||||
"smtp-connection": "^1.3.7"
|
||||
},
|
||||
"description": "SMTP transport for Nodemailer",
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.1",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-jshint": "^0.11.3",
|
||||
"grunt-mocha-test": "^0.12.7",
|
||||
"mocha": "^2.3.4",
|
||||
"sinon": "^1.17.2",
|
||||
"smtp-server": "^1.7.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "e6c37f31885ab3080e7ded3cf528c4ad7e691398",
|
||||
"tarball": "http://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-1.1.0.tgz"
|
||||
},
|
||||
"gitHead": "ff99dda93eca0c9183f05c63d39f102e18a8b8e9",
|
||||
"homepage": "http://github.com/andris9/nodemailer-smtp-transport",
|
||||
"keywords": [
|
||||
"Nodemailer",
|
||||
"SMTP"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/smtp-transport.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "andris",
|
||||
"email": "andris@node.ee"
|
||||
}
|
||||
],
|
||||
"name": "nodemailer-smtp-transport",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/andris9/nodemailer-smtp-transport.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
163
node_modules/nodemailer-smtp-transport/src/smtp-transport.js
generated
vendored
Normal file
163
node_modules/nodemailer-smtp-transport/src/smtp-transport.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
var SMTPConnection = require('smtp-connection');
|
||||
var packageData = require('../package.json');
|
||||
var wellknown = require('nodemailer-wellknown');
|
||||
var clone = require('clone');
|
||||
var urllib = require('url');
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var util = require('util');
|
||||
|
||||
// expose to the world
|
||||
module.exports = function (options) {
|
||||
return new SMTPTransport(options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a SMTP transport object for Nodemailer
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} options Connection options
|
||||
*/
|
||||
function SMTPTransport(options) {
|
||||
EventEmitter.call(this);
|
||||
|
||||
var hostData;
|
||||
|
||||
if (options && typeof options === 'string') {
|
||||
options = {
|
||||
url: options
|
||||
};
|
||||
}
|
||||
|
||||
this.options = options && clone(options) || {};
|
||||
|
||||
if (this.options.service && (hostData = wellknown(this.options.service))) {
|
||||
Object.keys(hostData).forEach(function (key) {
|
||||
if (!(key in this.options)) {
|
||||
this.options[key] = hostData[key];
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
// parse a configuration URL into configuration options
|
||||
if (this.options.url) {
|
||||
[urllib.parse(this.options.url, true)].forEach(function (url) {
|
||||
var auth;
|
||||
|
||||
this.options.secure = url.protocol === 'smtps:';
|
||||
|
||||
if (!isNaN(url.port) && Number(url.port)) {
|
||||
this.options.port = Number(url.port);
|
||||
}
|
||||
|
||||
if (url.hostname) {
|
||||
this.options.host = url.hostname;
|
||||
}
|
||||
|
||||
if (url.auth) {
|
||||
auth = url.auth.split(':');
|
||||
|
||||
if (!this.options.auth) {
|
||||
this.options.auth = {};
|
||||
}
|
||||
|
||||
this.options.auth.user = decodeURIComponent(auth[0]);
|
||||
this.options.auth.pass = decodeURIComponent(auth[1]);
|
||||
}
|
||||
|
||||
Object.keys(url.query || {}).forEach(function (key) {
|
||||
if (!(key in this.options)) {
|
||||
this.options[key] = url.query[key];
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
// temporary object
|
||||
var connection = new SMTPConnection(this.options);
|
||||
|
||||
this.name = 'SMTP';
|
||||
this.version = packageData.version + '[client:' + connection.version + ']';
|
||||
}
|
||||
util.inherits(SMTPTransport, EventEmitter);
|
||||
|
||||
/**
|
||||
* Sends an e-mail using the selected settings
|
||||
*
|
||||
* @param {Object} mail Mail object
|
||||
* @param {Function} callback Callback function
|
||||
*/
|
||||
SMTPTransport.prototype.send = function (mail, callback) {
|
||||
var connection = new SMTPConnection(this.options);
|
||||
var returned = false;
|
||||
|
||||
connection.on('log', function (log) {
|
||||
this.emit('log', log);
|
||||
}.bind(this));
|
||||
|
||||
connection.once('error', function (err) {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
connection.close();
|
||||
return callback(err);
|
||||
});
|
||||
|
||||
connection.once('end', function () {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
return callback(new Error('Connection closed'));
|
||||
});
|
||||
|
||||
var sendMessage = function () {
|
||||
connection.send(mail.data.envelope || mail.message.getEnvelope(), mail.message.createReadStream(), function (err, info) {
|
||||
var envelope;
|
||||
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
|
||||
connection.close();
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
envelope = mail.data.envelope || mail.message.getEnvelope();
|
||||
info.envelope = {
|
||||
from: envelope.from,
|
||||
to: envelope.to
|
||||
};
|
||||
info.messageId = (mail.message.getHeader('message-id') || '').replace(/[<>\s]/g, '');
|
||||
return callback(null, info);
|
||||
});
|
||||
};
|
||||
|
||||
connection.connect(function () {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.auth) {
|
||||
connection.login(this.options.auth, function (err) {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
returned = true;
|
||||
connection.close();
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
sendMessage();
|
||||
});
|
||||
} else {
|
||||
sendMessage();
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
Reference in New Issue
Block a user