Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed command line executable

  • Loading branch information...
commit 5cd4ccad42ed32fbc8ec3ac52a28c40f853dcd45 1 parent 2f1cd04
@andris9 authored
Showing with 4 additions and 262 deletions.
  1. +1 −50 README.md
  2. +0 −195 bin/nodemailer
  3. +1 −11 npm-shrinkwrap.json
  4. +2 −6 package.json
View
51 README.md
@@ -25,7 +25,6 @@ Nodemailer is Windows friendly, you can install it with *npm* on Windows just li
* Use objects as header values for **SendGrid** SMTP API
* **XOAUTH2** authentication and token generation support - useful with Gmail
* **DKIM** signing
- * Send e-mail from **command line**
### Support Nodemailer development
@@ -726,55 +725,7 @@ nodemailer.sendMail(mailOptions, function(error, responseStatus){
## Command line usage
-If installed globally with -g, nodemailer command enables to send mail from the command line. Run nodemailer --help for usage instructions.
-
- npm install -g nodemailer
- nodemailer --help
-
-And the response should be
-
-```
-Send mail with Nodemailer
-http://github.com/andris9/Nodemailer
-
-Syntax:
-nodemailer [options]
-
- --help show this message
- --transport=[transport] "smtp", "ses", "sendmail"
- --debug=true show debug log
-
-SMTP options
- --host=[hostname] SMTP server hostname
- --port=[port] SMTP server port
- --secure=[true:false] Use SSL when connecting
- --user=[username] SMTP username
- --pass=[password] SMTP password
-
-Amazon SES options
- --key=[AWSKey] Amazon SES key
- --secret=[AWSSecret] Amazon SES secret
-
-Mail options
- --from=[address] Sender of the mail
- --to=[addresslist] Comma separated list of To: addresses
- --cc=[addresslist] Comma separated list of Cc: addresses
- --bcc=[addresslist] Comma separated list of Bcc: addresses
- --subject=[subject] Message subject
- --text=[plaintext] Plain text mail body
- --html=[html] HTML mail body
- --textFile=[path] Plain text mail body from a file
- --htmlFile=[path] HTML mail body from a file
- --stdin=[target] Read "text" or "html" from stdin
- --attachments=[pathlist] Comma separated list of file paths
-```
-
-Example
-
-```
-nodemailer --host=smtp.gmail.com --port=465 --secure=true --user="myuser@gmail.com" --pass="mypass" --from="myuser@gmail.com" --to="target@blurdybloop.com" --subject="test" --text="hello world!"
-```
-
+**NB!** Command line usage was removed from v0.4
## Tests
View
195 bin/nodemailer
@@ -1,195 +0,0 @@
-#!/usr/bin/env node
-var nodemailer = require("../lib/nodemailer"),
- argv = require('optimist').argv;
-
-if(argv.help){
-
- console.log("Send mail with Nodemailer");
- console.log("http://github.com/andris9/Nodemailer");
- console.log("");
- console.log("Syntax:");
- console.log("nodemailer [options]");
- console.log("");
- console.log(" --help show this message");
- console.log(" --transport=[transport] \"smtp\", \"ses\", \"sendmail\"");
- console.log(" --debug=true show debug log");
- console.log("");
- console.log("SMTP options");
- console.log(" --host=[hostname] SMTP server hostname");
- console.log(" --port=[port] SMTP server port");
- console.log(" --secure=[true:false] Use SSL when connecting");
- console.log(" --user=[username] SMTP username");
- console.log(" --pass=[password] SMTP password");
- console.log("");
- console.log("Amazon SES options");
- console.log(" --key=[AWSKey] Amazon SES key");
- console.log(" --secret=[AWSSecret] Amazon SES secret");
- console.log(" --token=[STS Token] Amazon SES security token if using STS");
- console.log("");
- console.log("Mail options");
- console.log(" --from=[address] Sender of the mail");
- console.log(" --to=[addresslist] Comma separated list of To: addresses");
- console.log(" --cc=[addresslist] Comma separated list of Cc: addresses");
- console.log(" --bcc=[addresslist] Comma separated list of Bcc: addresses");
- console.log(" --subject=[subject] Message subject");
- console.log(" --text=[plaintext] Plain text mail body");
- console.log(" --html=[html] HTML mail body");
- console.log(" --textFile=[path] Plain text mail body from a file");
- console.log(" --htmlFile=[path] HTML mail body from a file");
- console.log(" --stdin=[target] Read \"text\" or \"html\" from stdin");
- console.log(" --attachments=[pathlist] Comma separated list of file paths");
- console.log("");
- console.log("Example:")
- console.log("nodemailer --host=smtp.gmail.com --port=465 --secure=true --user=\"myuser@gmail.com\" --pass=\"mypass\" --from=\"myuser@gmail.com\" --to=\"target@example.com\" --subject=\"test\" --text=\"hello world!\"");
- process.exit(0);
-}
-
-var configFile = argv.config || argv.c || process.env.NODEMAILER_CONFIG;
-
-if(configFile){
- configFile = require(configFile);
-}else{
- configFile = {}
-}
-
-var transportType = (argv.transport || configFile.transport || process.env.NODEMAILER_TRANSPORT || "").trim(),
- service = argv.service || configFile.service || process.env.NODEMAILER_SERVICE,
- user = argv.user || argv.u || configFile.user || process.env.NODEMAILER_USER,
- pass = argv.pass || argv.p || configFile.pass || process.env.NODEMAILER_PASS,
- host = argv.host || argv.h || configFile.host || process.env.NODEMAILER_HOST,
- port = argv.port || configFile.port || process.env.NODEMAILER_PORT,
- secure = (argv.secure || configFile.secure || process.env.NODEMAILER_SECURE || "").toString().toLowerCase().trim(),
- key = argv.key || argv.k || configFile.key || process.env.NODEMAILER_KEY,
- secret = argv.secret || configFile.secret || process.env.NODEMAILER_SECRET,
- token = argv.token || configFile.token || process.env.NODEMAILER_TOKEN;
-
-if(!transportType){
- transportType = host?"smtp": (key?"ses":"sendmail");
-}
-
-secure = ["false", "null", "0", "undefined"].indexOf(secure)>=0 ? false : !!secure;
-
-var transportOptions = {debug: !!argv.debug || !!argv.d};
-
-switch(transportType.toUpperCase().trim()){
- case "SMTP":
- if(service){
- transportOptions.service = service;
- }else{
- transportOptions.host = host;
- transportOptions.port = port;
- transportOptions.secureConnection = !!secure;
- }
- if(user){
- transportOptions.auth = {
- user: user,
- pass: pass
- }
- }
- break;
- case "SES":
- transportOptions.AWSAccessKeyID = key;
- transportOptions.AWSSecretKey = secret;
- transportOptions.AWSSecurityToken = token;
-}
-
-var transport = nodemailer.createTransport(transportType, transportOptions);
-
-
-var from = argv.from || argv.f || configFile.from || process.env.NODEMAILER_FROM,
- to = argv.to || argv.t,
- cc = argv.cc,
- bcc = argv.bcc,
- subject = argv.subject || argv.s,
- text = argv.text,
- html = argv.html,
- headers = argv.headers,
- attachments = (argv.attachment || argv.a || "").toString().trim();
-
-if(attachments.length){
- attachments = attachments.split(",").map(function(a){return {filePath: a.trim()}})
-}else{
- attachments = [];
-}
-
-if(argv.textFile){
- text = require("fs").readFileSync(argv.textFile, "utf-8");
-}
-
-if(argv.htmlFile){
- html = require("fs").readFileSync(argv.htmlFile, "utf-8");
-}
-
-if(argv.stdin){
- process.stdin.resume();
- process.stdin.setEncoding('utf8');
-
- var stdin = "";
-
- process.stdin.on('data', function (chunk) {
- stdin += chunk;
- });
-
- process.stdin.on('end', function () {
- if(argv.stdin == "text"){
- text = stdin;
- }else{
- html = stdin;
- }
- });
-}else{
- sendMessage();
-}
-
-
-function sendMessage(){
- var message = {};
- if(from){
- message.from = from;
- }
- if(to){
- message.to = to;
- }
- if(cc){
- message.cc = cc;
- }
- if(bcc){
- message.bcc = bcc;
- }
- if(subject){
- message.subject = subject;
- }
- if(text){
- message.text = text;
- }
- if(html){
- message.html = html;
- }
- if(html && !text){
- message.generateTextFromHTML = true;
- }
- if(headers){
- message.headers = JSON.parse(headers);
- }
- if(attachments && attachments.length){
- message.attachments = attachments;
- }
-
- transport.sendMail(message, function(err, resp){
- if(err){
- console.log("Error");
- console.log(err);
- console.log(resp);
- process.exit(1);
- return;
- }
- if(resp.failedRecipients && resp.failedRecipients.length){
- console.log("Warning: Failed to send mail to " + resp.failedRecipients);
- }
- console.log(resp.message);
- process.exit(0);
- });
-}
-
-// smtp://user:pass@domain:port
-// smtps://user:pass@domain:port
View
12 npm-shrinkwrap.json
@@ -1,6 +1,6 @@
{
"name": "nodemailer",
- "version": "0.3.44",
+ "version": "0.4.0",
"dependencies": {
"mailcomposer": {
"version": "0.1.31",
@@ -46,16 +46,6 @@
}
}
},
- "optimist": {
- "version": "0.3.5",
- "from": "optimist@0.3.5",
- "dependencies": {
- "wordwrap": {
- "version": "0.0.2",
- "from": "wordwrap@~0.0.2"
- }
- }
- },
"nodeunit": {
"version": "0.7.4",
"from": "nodeunit@*",
View
8 package.json
@@ -1,7 +1,7 @@
{
"name": "nodemailer",
"description": "Easy to use module to send e-mails, supports unicode and SSL/TLS",
- "version": "0.3.45",
+ "version": "0.4.0",
"author" : "Andris Reinman",
"maintainers":[
{
@@ -26,8 +26,7 @@
],
"dependencies": {
"mailcomposer": "~0.1",
- "simplesmtp": "~0.2",
- "optimist": "0.3.5"
+ "simplesmtp": "~0.2"
},
"devDependencies": {
"nodeunit": "*"
@@ -35,8 +34,5 @@
"engine": {
"node": ">=0.6"
},
- "bin": {
- "nodemailer" : "./bin/nodemailer"
- },
"keywords": ["e-mail", "mime", "email", "mail", "sendmail", "ses"]
}
Please sign in to comment.
Something went wrong with that request. Please try again.