Skip to content

Instantly share code, notes, and snippets.

@trouttdev
trouttdev / SparkPost.md
Last active November 16, 2016 08:20
How to add CC and BCC fields to SparkPost API

How to send a SparkPost email via API with a CC and BCC

Originally I found this which only vaguely pointed me in the right direction, so I thought I'd create a gist of what ended up working for me.

CC

To add a CC address, you have to two two things

  1. Add the address to your recipeints array, and set the header_to value to an address in the to field. So if you're sending the email to to_address@domain.com and CCing it to cc_address@domain.com, the header_to for cc_address@domain.com will need to be set to to_address@domain.com
  2. Add the email to the CC headers option in content object. If you have multiple emails, these should be comma separated.
@trouttdev
trouttdev / CacheResponse.php
Created January 11, 2017 18:39
Simple Laravel 5 response caching
<?php
namespace App\Http\Middleware;
use Closure;
use Cache;
class CacheResponse
{
/**
@trouttdev
trouttdev / my_module.module
Created February 1, 2017 16:03
Reject an entire feed import if a required field in feeds_tamper fails
/**
* Implements hook_feeds_after_parse().
*/
function my_module_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {
// $sql = "SELECT COUNT(*) FROM feeds_log WHERE request_time = " . REQUEST_TIME . " AND id = " . $source->id . " AND type LIKE '%feeds_tamper:required%'" ;
$number_of_prase_errors = db_select('feeds_log', 'f')
->fields('f', array('flid'))
->condition('request_time', REQUEST_TIME, '=')
@trouttdev
trouttdev / webpack.mix.js
Created August 23, 2021 15:49
Laravel Mix Config for pushing chunked assets to an S3 CDN
let mix = require('laravel-mix');
// require('laravel-mix-bundle-analyzer');
const s3Plugin = require('webpack-s3-plugin');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps