Last active
August 29, 2015 13:56
-
-
Save cmawhorter/9044714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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