Skip to content

Instantly share code, notes, and snippets.

@sendpulse
sendpulse / sample.py
Last active July 25, 2023 04:36
SendPulse SMTP API usage example
# SendPulse's Python Library: https://github.com/sendpulse/sendpulse-rest-api-python
from pysendpulse import PySendPulse
if __name__ == "__main__":
TOKEN_STORAGE = 'memcached'
SPApiProxy = PySendPulse(REST_API_ID, REST_API_SECRET, TOKEN_STORAGE)
email = {
'subject': 'This is the test task from REST API',
'html': '<p>This is a test task from https://sendpulse.com/api REST API!</p>',
'text': 'This is a test task from https://sendpulse.com/api REST API!',
'from': {'name': 'John Doe', 'email': 'john.doe@example.com'},
@sendpulse
sendpulse / sample.m
Last active December 31, 2023 19:14
SendPulse REST API Usage Example for Objective-C
#import "Sendpulse.h" // SendPulse's Obj-C Library https://github.com/sendpulse/sendpulse-rest-api-objective-c
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomethingWithTheData:) name:@"SendPulseNotification" object:nil];
Sendpulse* sendpulse = [[Sendpulse alloc] initWithUserIdandSecret:userId :secret];
NSDictionary *from = [NSDictionary dictionaryWithObjectsAndKeys:@"Your Sender Name", @"name", @"your-sender-email@gmail.com", @"email", nil];
NSMutableArray* to = [[NSMutableArray alloc] initWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"Subscriber's name", @"name", @"subscriber@gmail.com", @"email", nil], nil];
NSMutableDictionary *emaildata = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"<b>Your email content goes here</b>", @"html", @"Your email text version goes here", @"text",@"Testing SendPulse API",@"subject",from,@"from",to,@"to", nil];
[sendpulse smtpSendMail:emaildata];
}
@sendpulse
sendpulse / sample.js
Last active March 18, 2022 20:59
SendPulse REST API Usage Example for Node.js (https://sendpulse.com/api)
// SendPulse's Node.JS Library: https://github.com/sendpulse/sendpulse-rest-api-node.js
var sendpulse = require("./api/sendpulse.js");
sendpulse.init(API_USER_ID,API_SECRET,TOKEN_STORAGE);
var email = {
"html" : "<p>Your email content goes here</p>",
"text" : "Your email text version goes here",
"subject" : "Testing SendPulse API",
"from" : {
"name" : "Your Sender Name",
@sendpulse
sendpulse / sample.php
Last active May 4, 2021 21:12
SendPulse REST API Usage Example foк PHP (https://sendpulse.com/api)
<?php
// SendPulse's PHP Library: https://github.com/sendpulse/sendpulse-rest-api-php
require_once( 'api/sendpulseInterface.php' );
require_once( 'api/sendpulse.php' );
$SPApiProxy = new SendpulseApi( API_USER_ID, API_SECRET, 'file' );
$email = array(
'html' => 'Your email content goes here',
'text' => 'Your email text version goes here',
'subject' => 'Testing SendPulse API',
@sendpulse
sendpulse / sample.rb
Last active August 1, 2017 17:17
SendPulse REST API Usage Example for Ruby https://github.com/sendpulse/sendpulse-rest-api-ruby
# SendPulse's Ruby Library: https://github.com/sendpulse/sendpulse-rest-api-ruby
require './api/sendpulse_api'
sendpulse_api = SendpulseApi.new(API_CLIENT_ID, API_CLIENT_SECRET, API_PROTOCOL, API_TOKEN)
email = {
html: '<p>Your email content goes here<p>',
text: 'Your email text version goes here',
subject: 'Testing SendPulse API',
from: { name: 'Your Sender Name', email: 'your-sender-email@gmail.com' },
to: [
@sendpulse
sendpulse / sample.java
Last active August 29, 2015 14:23
SendPulse REST API Usage Example for Java
// SendPulse's Java Library https://github.com/sendpulse/sendpulse-rest-api-java
import com.sendpulse.restapi.Sendpulse;
public class Example {
public static void main(String[] args) {
Sendpulse sendpulse = new Sendpulse(API_CLIENT_ID, API_CLIENT_SECRET);
Map<String, Object> from = new HashMap<String, Object>();
from.put("name", "Your Sender Name");
from.put("email", "your-sender-email@gmail.com");
ArrayList<Map> to = new ArrayList<Map>();
Map<String, Object> elementto = new HashMap<String, Object>();