Prolateral Consulting Ltd
Prolateral Consulting Ltd
Knowledgebase Articles
Setup examples

Prolateral offers primary and backup domain (DNS) services, with servers in key geographic locations providing the best service possible.


How do I set up outbound SMTP using the net/smtp package?
How do I use outMail in Go with net/smtp?


The following example of code assumes you have already got a fully functional development environment installed.

The below example of code shows you how to use outMail as the outgoing SMTP relay using the net/smtp package in Go (GoLang)

outMail is an authenticated SMTP relay so the example below shows authentication in perl as well. The code below uses the default SMTP port 25 but it can easily be changed to an alternative SMTP port by changing the addr: parameter.

Example code smtp-test.go.

package main

import (

func main() {

    // Set the address information 
    from := ""

    to := []string{

    // Set the SMTP Credentials
    user := "outmail-username"
    password := "outmail-password"

    // Set the SMTP Server information the SMTP Port
    addr := ""
    host := ""

    // Create the Message
    msg := []byte("From:\r\n" +
        "To:\r\n" +
        "Subject: Test mail\r\n\r\n" +
        "Email body\r\n")

    // Create the Auth
    auth := smtp.PlainAuth("", user, password, host)

    // Send the message
    err := smtp.SendMail(addr, auth, from, to, msg)

    // Check for errors
    if err != nil {

    fmt.Println("Email sent successfully")

Summary of server details

Outgoing server

As provided in your signup email.

Outgoing server protocol


Outgoing server port

25, 465, 587, 2525 or 8025

Authentication Type

Basic Authentication, SSL and TLS supported


As provided


As provided


like it, love it, then share it. Share this article on social media.

Did you enjoy this article?


The Origin of this information may be internal or external to Prolateral Consulting Ltd. Prolateral makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Prolateral makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.