-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from SparkPost/master
up
- Loading branch information
Showing
57 changed files
with
6,050 additions
and
1,083 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
**/.*.swp | ||
.vscode | ||
|
||
**/*.test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
language: go | ||
sudo: false | ||
go: | ||
- 1.5 | ||
- 1.7 | ||
before_install: | ||
go get github.com/mattn/goveralls | ||
script: | ||
- $HOME/gopath/bin/goveralls -service=travis-ci -ignore 'cmd/*/*.go,examples/*/*.go,helpers/*/*.go' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Tools for SparkPost and/or Email | ||
|
||
### [fblgen](./fblgen/) | ||
|
||
Generate and optionally send an FBL report in response to an email sent through SparkPost. | ||
|
||
### [mimedump](./mimedump/) | ||
|
||
Extract the HTML part of a saved email message. | ||
|
||
### [oobgen](./oobgen/) | ||
|
||
Generate and optionally send an out-of-band (OOB) bounce from an email with full headers. | ||
|
||
### [qp](./qp/) | ||
|
||
Encode or decode quoted-printable data. Inspired by the `base64` command-line tool, supports the same long options. | ||
|
||
### [sparks](./sparks/) | ||
|
||
Send email through SparkPost from the command line. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## fblgen | ||
|
||
Testing your response to FBL reports doesn't have to involve waiting for an angry/lazy recipient to click "This is Spam". | ||
Here's how to send an FBL report in response to a message sent via SparkPost, and saved (with full headers) to a local file: | ||
|
||
$ ./fblgen --file ./test.eml --verbose | ||
Got domain [sparkpostmail.com] from Return-Path | ||
Got MX [smtp.sparkpostmail.com.] for [sparkpostmail.com] | ||
Would send FBL from [[email protected]] to [[email protected]] via [smtp.sparkpostmail.com.:smtp] | ||
|
||
Note that this command (once you've added the `--send` flag) will attempt to connect from your local machine to the MX listed above. | ||
It's entirely possible that there will be something blocking that port, for example a firewall, or your residential ISP. | ||
Here are [two](http://nc110.sourceforge.net/) [ways](https://nmap.org/ncat/) to check whether that's the case. | ||
Whichever command you run should return in under a second. | ||
If there's a successful connection, you're good to go. | ||
|
||
$ nc -vz -w 3 smtp.sparkpostmail.com 25 | ||
$ </dev/null ncat -vw 3s --send-only smtp.sparkpostmail.com 25 | ||
|
||
If you get a timeout, there are a couple solutions. The easiest is to `ssh` somewhere that allows outbound connections on port 25. Searching for "free ssh" will give you quite a few options, if you don't happen to have that sort of access set up already. My nostalgic favorite is [SDF](http://sdf.lonestar.org/). | ||
|
||
Another option is to route your connections over a VPN, which is more involved, and out of the scope of this document. | ||
|
||
Happy testing! |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## oobgen | ||
|
||
Testing your response to out-of-band (OOB) bounces doesn't have to involve waiting for one to be sent to you. | ||
Here's how to send an OOB bounce in response to a message sent via SparkPost, and saved (with full headers) to a local file: | ||
|
||
$ ./oobgen --file ./test.eml --verbose | ||
Got domain [sparkpostmail.com] from Return-Path | ||
Got MX [smtp.sparkpostmail.com.] for [sparkpostmail.com] | ||
Would send OOB from [[email protected]] to [[email protected]] via [smtp.sparkpostmail.com.:smtp] | ||
|
||
Note that this command (once you've added the `--send` flag) will attempt to connect from your local machine to the MX listed above. | ||
It's entirely possible that there will be something blocking that port, for example a firewall, or your residential ISP. | ||
Here are [two](http://nc110.sourceforge.net/) [ways](https://nmap.org/ncat/) to check whether that's the case. | ||
Whichever command you run should return in under a second. | ||
If there's a successful connection, you're good to go. | ||
|
||
$ nc -vz -w 3 smtp.sparkpostmail.com 25 | ||
$ </dev/null ncat -vw 3s --send-only smtp.sparkpostmail.com 25 | ||
|
||
If you get a timeout, there are a couple solutions. The easiest is to `ssh` somewhere that allows outbound connections on port 25. Searching for "free ssh" will give you quite a few options, if you don't happen to have that sort of access set up already. My nostalgic favorite is [SDF](http://sdf.lonestar.org/). | ||
|
||
Another option is to route your connections over a VPN, which is more involved, and out of the scope of this document. | ||
|
||
Happy testing! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"time" | ||
) | ||
|
||
// FIXME: allow swapping out the error message | ||
var OobFormat string = `From: %s | ||
Date: Mon, 02 Jan 2006 15:04:05 MST | ||
Subject: Returned mail: see transcript for details | ||
Auto-Submitted: auto-generated (failure) | ||
To: %s | ||
Content-Type: multipart/report; report-type=delivery-status; | ||
boundary="%s" | ||
This is a MIME-encapsulated message | ||
--%s | ||
The original message was received at Mon, 02 Jan 2006 15:04:05 -0700 | ||
from example.com.sink.sparkpostmail.com [52.41.116.105] | ||
----- The following addresses had permanent fatal errors ----- | ||
<%s> | ||
(reason: 550 5.0.0 <%s>... User unknown) | ||
----- Transcript of session follows ----- | ||
... while talking to %s: | ||
>>> DATA | ||
<<< 550 5.0.0 <%s>... User unknown | ||
550 5.1.1 <%s>... User unknown | ||
<<< 503 5.0.0 Need RCPT (recipient) | ||
--%s | ||
Content-Type: message/delivery-status | ||
Reporting-MTA: dns; %s | ||
Received-From-MTA: DNS; %s | ||
Arrival-Date: Mon, 02 Jan 2006 15:04:05 MST | ||
Final-Recipient: RFC822; %s | ||
Action: failed | ||
Status: 5.0.0 | ||
Remote-MTA: DNS; %s | ||
Diagnostic-Code: SMTP; 550 5.0.0 <%s>... User unknown | ||
Last-Attempt-Date: Mon, 02 Jan 2006 15:04:05 MST | ||
--%s | ||
Content-Type: message/rfc822 | ||
%s | ||
--%s-- | ||
` | ||
|
||
func BuildOob(from, to, rawMsg string) string { | ||
boundary := fmt.Sprintf("_----%d===_61/00-25439-267B0055", time.Now().Unix()) | ||
fromDomain := from[strings.Index(from, "@")+1:] | ||
toDomain := to[strings.Index(to, "@")+1:] | ||
msg := fmt.Sprintf(OobFormat, | ||
from, to, boundary, | ||
boundary, to, to, toDomain, to, to, | ||
boundary, toDomain, fromDomain, to, toDomain, to, | ||
boundary, rawMsg, | ||
boundary) | ||
return msg | ||
} |
Oops, something went wrong.