Skip to content
Gihan Karunarathne edited this page Jun 17, 2014 · 1 revision

3. Email

Email Service.

swisher_client.Email("appSecret", "appId", [options])

var swisher_client = require('swisher-client'),
    email = swisher_client.Email("7780aa6c75f9439ed416e0501294a3831abe1a05", "8", {
      grantType : "access_token",
      scope     : "test"
    });

email.send(to, from, subject, message, optional, callback)

Parameters:

to (Array of JSON Objects)

In this parameter, it should be specified recipients’details as a json array.

from (JSON Object)

Details of the sender.This also should be specified as a json object. Single email and name parameters as a object.

subject (String)

Subject of the email which it to be sent..

message (JSON Object)

Message that you want to send. This should be specified as a json array.

optional (JSON)

Optional parameters (Empty object such as {} or JSON object provide with key value pairs);

  • cc (Array of JSON objects) Carbon Copy address. This also should be specified as a json array.

  • bcc (Array of JSON objects) Blind Carbon Copy address. This also should be specified as a json array.

email.send(
  [
    {"name": "JohnTaylor", "email": "john@example.com"},
    {"name": "JimmyHolder", "email": "jimmy@example.com"}
  ],
  {"name": "AndrewSmith", "email": "smith@example.com"},
  "Introducing New Service",
  [
    {"type": "text", "content": "TestMessage"}
  ],
  {
    "bcc": [
      {"name": "SandraCollins", "email": "collins@example.com"}
    ],
    "cc": [
      {"name": "MikeTracer", "email": "mike@example.com"}
    ]
  },
  function (err, result) {
    if (err) {
      // Handle Error Here
    } else {
      // -- Code Here
    }
  });

Clone this wiki locally