Skip to content

Instantly share code, notes, and snippets.

@cmawhorter
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmawhorter/9044714 to your computer and use it in GitHub Desktop.
Save cmawhorter/9044714 to your computer and use it in GitHub Desktop.
<?php
// Stampr Mailing Hello World in PHP!
require 'vendor/autoload.php';
require 'src/Stampr/Stampr.php';
$stampr_login = "your.stampr.login@example.com";
$stampr_password = "your.stampr.password";
$endpoint = "https://stam.pr/api";
$stampr = new Stampr($stampr_login, $stampr_password, $endpoint);
$to = "John Smith\n";
$to .= "123 Fake St.\n";
$to .= "Someplaceville, CA 90210";
$from = "Homer Simpson\n";
$from .= "742 Evergreen Tr.\n";
$from .= "Springfield, IL 12345";
// If batch_id is null, a new Batch and Config will be created just for the mailing.
// If you'd like to group mailings together, be sure to create a batch and pass it
// along to send.
// For testing, we recommend creating a special Testing batch with a status set
// to 'hold'. This will prevent your test mailings from actually being created.
$batch_id = null;
$mailing = $stampr->mail($to, $from, '<h1>Hello World!</h1><p>How are you doing today?</p>', $batch_id);
print "Mailing #" . $mailing->getId() ." was created\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment