Ho to send email from a website using Golang

I have done a rough sketch using Golang as “webserver” and used pure html, css and Javascript. It was not that easy that I thought, but the main goal was speed.

But I cannot figure out how to communicate from the website in order to send an email.

It is possible to replace

<form action="action_page.php">


<form action="action_page.go">


You can have a url endpoint where you send form data as POST body and handler of that url will do the rest of the work.

Thanks. Any examples or links that shows this?

How are you rendering contact page when you get “/contact” in url? Do the same but before sending back html, do the ops and depending on if the email was or wasn’t sent successfully send some message to your contact.html template and show contact page again with that message

1 Like

I used in my projects gopkg.in/gomail.v2 for sending mails. An example using fields from a form is here.


Related post on StackOverflow:

How to send an email using Go with an HTML formatted body?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.