Sending Email Using Go And Mailgun Image Sending Email Using Go And Mailgun

In this tutorial I'm going to be demonstrating how you can send mail with Go(Lang) and the mailgun api. Thankfully, mailgun's API is fantastic and sending mail is incredibly easy once you've set everything up properly.



package main

import (

func SendSimpleMessage(domain, apiKey string) (string, error) {
  mg := mailgun.NewMailgun("", apiKey, "key-12345671234567")
  m := mg.NewMessage(
    "Excited User <>",
    "Testing some Mailgun!",
  _, id, err := mg.Send(m)
  return id, err

func main(){
    SendSimpleMessage("", "key-12345671234567")

Elliot Forbes

Elliot Forbes
Twitter: @Elliot_f

Hey, I'm Elliot and I've been working on TutorialEdge for the last 4 years! If my work has helped you in any way, shape, or form then please consider supporting my work.

become a patron Buy Me A Coffee