An Email SDK for SendCloud
Welcome PRs.
- Node.js > v7.0.*
- axios
- debug
npm i --save mail-sc.js
Example 1: Recommended. See APIs
const {
createClient, decomposeAddress, addressParser
} = require('mail-sc.js');
const options = {apiKey: 'your key', apiUser: 'your user'};
const sendCloud = createClient(options);
const address = 'tester<[email protected]>';
const decomposed = decomposeAddress(address);
const addr1 = ['[email protected]', '[email protected]'];
const addr2 = '[email protected], [email protected], [email protected]';
console.log(addressParser(addr1));
// '[email protected];[email protected]'
console.log(addressParser(addr2, ','));
// '[email protected];[email protected];[email protected]'
const message = {
from: decomposed.address,
fromName: decomposed.name,
to: 'test1@test,com',
subject: 'test subject',
html: 'test message'
};
const sendMessage = async () => {
return await sendCloud.delivery.send(message);
}
sendMessage();
const {
SendCloud, decomposeAddress
} = require('mail-sc.js');
const options = {apiKey: 'your key', apiUser: 'your user'};
const sendCloud = new SendCloud(options);
const address = 'tester<[email protected]>';
const decomposed = decomposeAddress(address);
const message = {
from: decomposed.address,
fromName: decomposed.name,
to: 'test1@test,com',
subject: 'test subject',
html: 'test message'
};
const sendMessage = async () => {
return await sendCloud.send(message);
}
sendMessage();
apiKey
- The send cloud apiKeyapiUser
- The send cloud apiUserhost
- The hostname of send cloud api [default
: api.sendcloud.net]protocol
- http|https [default
: http]port
- [default
: 80]retry
- [default
: 1]proxy
- axios proxy [default
: null]timeout
- axios timeout [default
: 1000 * 6]
- delivery.send(Object) - Regular delivery
- delivery.sendTemplate(Object) - Template delivery
- delivery.sendCalendar(Object) - Send meeting calendar
- delivery.taskInfo(Object) - List task info
- template.batchQuery(Object) - Basic information of returned email template
- template.query(Object) - Detailed information of returned email template
- template.add(Object) - Adding template to sendCloud
- template.delete(Object) - Deleting email template from sendCloud
- template.update(Object) - Name, content, subject and type of the template can be modified.
- addressList.batchQueryAddress(Object) - Query address list (batch query)
- addressList.addAddress(Object) - Adding address to list
- addressList.deleteAddress(Object) - Deleting address list
- addressList.updateAddress(Object) - Modify address list or update address list
- addressList.batchQueryMember(Object) - Query list member (batch query)
- addressList.queryMember(Object) - Query list member
- addressList.addMember(Object) - Add list member
- addressList.updateMember(Object) - Modify list member
- addressList.deleteMember(Object) - Delete list member
- emailLabel.batchQuery(Object) - List of returned labels (batchQuery)
- emailLabel.getLabel(Object) - Get one label by labelId
- emailLabel.add(Object) - Adding label
- emailLabel.delete(Object) - Deleting email label by id
- emailLabel.update(Object) - List of returned labels (batchQuery)
- Deliveries -
2019-02-15
- Email Template -
2019-02-21
- Address List -
2019-02-21
- Email Label -
2019-03-1
- Domain
- API_USER
- User Information
- Statistics
- Delivery Response
- Bounce List Management
- Unsubscribe Management
- Spam Report Management
- Lists of Opens And Clicks Management
- .addressParser(addresses, tag) - Normalizing email address list or email string list
- .decomposeAddress(address) - Decomposing an email address into fromName & address
MIT License
Copyright (c) 2019 Danielsss
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.