Skip to content

Instantly share code, notes, and snippets.

View byjujohn's full-sized avatar

Byju John byjujohn

View GitHub Profile
@byjujohn
byjujohn / SparkPost cURL Create (POST) Transmissions API Example
Created April 27, 2016 10:19 — forked from bdeanindy/SparkPost cURL Create (POST) Transmissions API Example
cURL POST Example to send an email using the SparkPost Transmissions API
curl \
-H "Content-Type: application/json" \
-H "Authorization: <REPLACE_WITH_YOUR_API_KEY>" \
-X POST -d '{"options":{"open_tracking":true,"click_tracking":true},"return_path":"bounces@<REPLACE_WITH_YOUR_SENDING_DOMAIN_HERE>","metadata":{"some_useful_metadata":"testing_sparkpost"},"substitution_data":{"signature":"<REPLACE_WITH_YOUR_FIRST_AND_LAST_NAME>"},"recipients":[{"address":{"email":"<REPLACE_WITH_YOUR_EMAIL_ADDRESS>","tags":["learning"],"substitution_data":{"customer_type":"Platinum","first_name":"<REPLACE_WITH_YOUR_FIRST_NAME>"}}}],"content":{"from":{"name":"Awesome Company","email":"testing@<REPLACE_WITH_YOUR_SENDING_DOMAIN>"},"subject":"My first SparkPost Transmission","reply_to":"Awesome Company ","text":"Hi {{address.first_name}}\r\nYou have just sent your first email through SparkPost!\r\nCongratulations,\r\n{{signature}}","html":"<strong>Hi {{address.first_name}},</strong><p>You have just sent your first email through SparkPost!</p><p>Congratulations!</p>{{signature}}"}}' \
https://api.sparkpos
@byjujohn
byjujohn / slackpost
Created January 29, 2016 09:17 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@byjujohn
byjujohn / gist:4501574
Created January 10, 2013 12:11 — forked from hightemp/gist:2387916
Magento : Usefull Code Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@byjujohn
byjujohn / gist:3713871
Created September 13, 2012 11:57 — forked from smonteverdi/gist:1993942
PHP: Send Email
<?
if (isset($_REQUEST["id"]) && ($_REQUEST["id"]<>"")) {
$data1=mysql_query("SELECT * FROM your_table WHERE id=".$_REQUEST["id"]);
$data=mysql_fetch_array($data1);
$from =mymail@mydomain.com;
$to = $data["email_field"];
$user = $data["name_field"];
$subject = "Enter your subject line here"; /*or if it comes from the table*/ $subject = $data["subject_field"];
$header="From:" . $from . "\r\n " ."Reply-To:". $from ;
$body="Hello ". $user .",\n\nFirst line\n\nYour message goes here, \nbest regards,\nyour_name and such\n";
@byjujohn
byjujohn / email.php
Created September 13, 2012 11:57 — forked from michaelaguiar/email.php
PHP - Send Email
<?php
// Configuration
$myEmail = 'YOUR EMAIL HERE';
$error = '';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
<?php
echo "Connecting to MySQL Server ... ";
mysql_connect(
"localhost",
"admin",
"pass123")
or die(mysql_error());
echo "[OK]<br />";