Skip to content

Instantly share code, notes, and snippets.

@matipan
Created March 9, 2017 02:35
Show Gist options
  • Save matipan/51409a212d66f72a50163bfe4f0adcfc to your computer and use it in GitHub Desktop.
Save matipan/51409a212d66f72a50163bfe4f0adcfc to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"log"
"net/http"
"net/url"
"os"
"strings"
)
func main() {
f, err := os.Open("mails-carpinteros")
if err != nil {
log.Fatal(err)
}
defer f.Close()
reader := bufio.NewReader(f)
for {
s, err := reader.ReadString('\n')
if err != nil {
break
}
s = strings.Trim(s, "\n")
s = strings.TrimSpace(s)
resp, err := http.PostForm("https://antoniopan.herokuapp.com/category/email/new", url.Values{"category": {"carpinteros"}, "email": {s}})
if err != nil {
log.Fatal(err)
}
fmt.Printf("posting email %v got %v\n", s, resp.StatusCode)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment