new SGAppsServerEmail(config)
- Source:
Example
Example:
var Email = require('path/to/email').Email
var myMsg = new Email(
{ from: 'me@example.com'
, to: 'you@example.com'
, subject: 'Knock knock...'
, body: "Who's there?"
})
myMsg.send(function(err){
...
})
Parameters:
Name | Type | Description |
---|---|---|
config |
SGAppsServerEmail.Config | optional configuration object |
Members
(readonly) encodedBody :string
- Source:
getter generate encoded body
Type:
- string
(readonly) msg :string
- Source:
getter generate all email structure
Type:
- string
(readonly) options :object
- Source:
Properties:
Name | Type | Description |
---|---|---|
timeout |
number |
get message options
Type:
- object
Methods
(static) from(email) → {string}
- Source:
Email address from which messages are sent. Used
when from
was not set on a message.
Parameters:
Name | Type | Description |
---|---|---|
email |
string |
Returns:
- Type
- string
(static) isValidAddress(email) → {boolean}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
email |
string |
Returns:
- Type
- boolean
(static) timeout(milliseconds) → {number}
- Source:
Duration in milliseconds to wait before
killing the process. Defaults to 3000. Used when timeout
is not set
on a message.
Parameters:
Name | Type | Description |
---|---|---|
milliseconds |
number |
Returns:
- Type
- number
send(callback)
- Source:
Send email
Parameters:
Name | Type | Description |
---|---|---|
callback |
SGAppsServerEmail.Callback |
valid(callback)
- Source:
check if email is valid
Parameters:
Name | Type | Description |
---|---|---|
callback |
SGAppsServerEmail.Callback |
Type Definitions
Callback(err)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error |
Config
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
to |
Array.<string> | string | Email address(es) to which this msg will be sent |
||
debug |
boolean |
<optional> |
false
|
|
from |
string |
<optional> |
Email address from which this msg is sent. If not set defaults to the |
|
replyTo |
string |
<optional> |
Email address to which replies will be sent. If not
set defaults to |
|
cc |
string | Array.<string> |
<optional> |
Email address(es) who receive a copy |
|
bcc |
string | Array.<string> |
<optional> |
Email address(es) who receive a blind copy |
|
subject |
string | The subject of the email |
||
body |
string | The message of the email |
||
bodyType |
string |
<optional> |
Content type of body. Only valid option is 'html' (for now). Defaults to text/plain. |
|
altText |
string |
<optional> |
If |
|
timeout |
number |
<optional> |
Duration in milliseconds to wait before killing the
process. If not set, defaults to |
|
path |
string |
<optional> |
Optional path to the sendmail executable. |
Email : Sends email using the sendmail command.
Note: sendmail must be installed: see http://www.sendmail.org/
Type:
- object