[Go Revel] Mailtrapによるメール送信

gmailのsmtpで送信する場合と書き方はほぼ同じ

func (c App) Mail() revel.Result {

	name := "hpscript"
	email := "test@hpscript.com"
	comments := "桜木町の夜景は良いですね"

	auth := smtp.PlainAuth (
		"",
		"hogehoge", // Mailtrap Username
		"fugafuga", // Mailtrap Password
		"smtp.mailtrap.io",
	)

	msg := []byte("From: info@hpscript.com\r\n" +
		"To: " +email + "\r\n" +
		"Subject: SMTPテスト\r\n" +
		"\r\n" +
		"名前: " + name + "\r\n" +
		"メールアドレス" + email + "\r\n" +
		"問い合わせ内容: " + comments + "\r\n")

	err := smtp.SendMail(
		"smtp.mailtrap.io:25",
		auth,
		"info@hpscrpt.com",
		[]string{email}, // 宛先
		msg,
	)

	if err != nil {
		fmt.Println(err)
	}
	return c.Render()
}

OKOK