Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed hostname parameter requirement for SMTP set-up as it was a bi…

…t confusing, defaults to os.hostname
  • Loading branch information...
commit 7c429d79b678de8ff0ec055ceb3c0a29f980c429 1 parent b0f9ff4
andris9 authored
View
8 README.md
@@ -76,9 +76,8 @@ the message etc - in this case you should re-schedule sending this e-mail. If *s
Before sending e-mails you need to set up SMTP server parameters.
nodemailer.SMTP = {
- host: "smtp.example.com",
- port: 25,
- hostname: "myhost.com", // needed to identify the client to the server, should be a valid domain
+ host: "smtp.example.com", // required
+ port: 25, // optional, defaults to 25 or 465
use_authentication: false,
user: "",
pass: ""
@@ -93,7 +92,6 @@ If you want to use SSL (not TLS/STARTTLS, just SSL), you need to set the ssl par
nodemailer.SMTP = {
host: "smtp.gmail.com",
port: 465,
- hostname: "myhost.com",
ssl: true,
use_authentication: true,
user: "my.username@gmail.com",
@@ -133,6 +131,8 @@ There's an optional extra field **headers** which holds custom header values in
}
}
+For debugging set **debug** to true - then all the data passed between the client and the server will be output to console.
+
Address Formatting
------------------
View
12 examples/example.js
@@ -4,12 +4,12 @@ var nodemailer = require("../lib/mail");
// Set up SMTP server settings
// NB! Authentication only works if the server doesn't require auth over TLS
nodemailer.SMTP = {
- host: "smtp.example.com",
- port: 25,
- hostname: "myhost.com",
- use_authentication: false,
- user: "",
- pass: ""
+ host: "smtp.gmail.com",
+ port: 465,
+ use_authentication: true,
+ ssl: true,
+ user: "your.username@gmail.com",
+ pass: "your_gmail_password"
}
// unique cid value for the embedded image
View
2  lib/mail.js
@@ -36,7 +36,7 @@ var X_MAILER_NAME = "Nodemailer",
**/
exports.SMTP = {
host: false,
- port: 25,
+ port: false,
hostname: false,
use_authentication: false,
ssl: false,
View
8 lib/smtp.js
@@ -1,6 +1,7 @@
var netlib = require("net"),
fslib = require("fs"),
utillib = require("util"),
+ oslib = require('os'),
EventEmitter = require('events').EventEmitter, tls;
/**
@@ -62,8 +63,9 @@ exports.SMTPClient = SMTPClient;
* options can include following data:
*
* - hostname (String): hostname of the sending server, needed for handshake
- * default is "untitled.server"
+ * defaults to OS hostname or "localhost"
* - use_authorization (Boolean): is authorization needed, default is false
+ * - ssl (Boolean): use SSL (port 465)
* - user (String): the username if authorization is needed
* - pass (String): the password if authorization is needed
*
@@ -86,9 +88,9 @@ function SMTPClient(host, port, options){
// Public properties
// -----------------
this.host = host;
- this.port = port || 25;
this.options = options || {};
- this.hostname = this.options.hostname || "untitled.server";
+ this.port = port || (this.options.ssl && 465 || 25);
+ this.hostname = this.options.hostname || oslib.hostname() || "untitled.server";
this.debug = !!this.options.debug;
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "nodemailer",
"description": "Easy to use module to send e-mails",
- "version": "0.1.3",
+ "version": "0.1.4",
"author" : "Andris Reinman",
"maintainers":[
{
Please sign in to comment.
Something went wrong with that request. Please try again.