Lightweight SMTP client written in Go

Overview

Hectane

Build Status - Linux Build status - Windows GoDoc MIT License

Hectane is both a Go package providing an SMTP queue for sending emails and a standalone application that exposes this functionality via an HTTP API.

Features

  • Ability to attach files to emails
  • Support for TLS encryption and HTTP basic auth
  • Mail queue that efficiently delivers emails to hosts
  • Emails in the queue are stored on disk until delivery
  • MX records for the destination host are tried in order of priority
  • Run the application as a service on Windows

Documentation

Documentation for Hectane can be found below:

Installation

In addition to the files on the releases page, Hectane can be installed from any of the sources below:

Comments
  • Unable to use UTF-8 characters in addresses and subject

    Unable to use UTF-8 characters in addresses and subject

    According to RFC 5322, it would appear that non-UTF-7 values must be encoded when used in MIME message headers. Hectane does not currently do this, which leads to errors when sending emails with UTF-8 content in an address or subject line.

    The relevant functions / types in Go are located here. I will try to get this fixed within the next two to three days.

    (issue originally filed here)

    bug 
    opened by nathan-osman 7
  • Add support for

    Add support for "Reply-To" in /send API

    I think Reply-To is a pretty common header. It would be a useful addition to the /send API.

    Why is it important to me: Wordpress forms plugin uses the wordpress admin email as From:, but the contacter email's as Reply-To. Setting the contacter as From is possible, but increases the odds of the email being classified as spam. Here, it ends up in spam every time unless I create a special rule based on the email's subject.

    opened by j3k0 7
  • alpine version

    alpine version

    I'm a great fan of your project and a great fan of docker. Now I was a great fan of Alpine, while it ran all of my apps from a way smaller image. But I found hectane not working in this environment alpine:3.4 or alpine:edge. Do you which library is missing in Alpine Linux? Maybe we can make it run after all..

    opened by scher200 5
  • 0.3.2 release with sirupsen rename included?

    0.3.2 release with sirupsen rename included?

    Heya,

    Having some trouble using go mod, because one of the transitive dependencies is using sirupsen/logrus, like the latest Hexane does (3535bbf44c3f32de551c1b8e5f0dab774cfd7e41).

    Problem is the latest Hexane release still has the old repo name.

    Is there any chance of cutting a new point release, even though it'll mostly be just the updated sirupsen repo name? :smile:

    opened by justinclift 3
  • Correctly implement SPF

    Correctly implement SPF

    According to this document, Gmail behaves in the following way when displaying received messages:

    • If a message was correctly DKIM signed, a 'signed-by' header with the sending domain will appear.
    • If a message was SPF authenticated, a 'mailed-by' header with the domain name will appear.
    • If no authentication information exists, you'll see a question mark icon next to the sender's name.

    Hectane implements neither of these standards and therefore a question mark appears. It would be nice if this could somehow be fixed.

    enhancement 
    opened by nathan-osman 1
  • Run Hectane as a Windows service

    Run Hectane as a Windows service

    Although Hectane runs without any issues on Windows, the application must be manually started. It would be excellent if the program could be run as a Windows service, simplifying management.

    Note: issue #13 may need to be resolved before this can be completed.

    enhancement 
    opened by nathan-osman 1
  • Tests

    Tests

    There are a lot of functions (especially in the util package) that need to have unit tests written for them. Since a lot of the code is being rewritten and moved around, having tests to ensure that more stuff doesn't get broken is extremely important.

    • [x] NonBlockingChan type
    • [x] mail utility functions
    • [x] Email to Message conversion
    enhancement 
    opened by nathan-osman 1
  • Support email delivery through SMTP

    Support email delivery through SMTP

    The HTTP interface works extremely well for delivering mail to the queue, but adding support for every framework, blog, and web app out there is becoming tedious. It would be nice if Hectane supported SMTP delivery, like Postfix.

    enhancement 
    opened by nathan-osman 0
  • Option to write stderr to log

    Option to write stderr to log

    Currently, Hectane writes all log output to stderr (with a special hook for the event viewer on Windows). This leads to problems when Hectane is run under init. Output goes absolutely nowhere. Therefore, an option should be provided to redirect log output to a file.

    enhancement 
    opened by nathan-osman 0
  • Load configuration from a file

    Load configuration from a file

    Hectane expects all information to be provided via command-line arguments. It should also be possible to specify a file containing the configuration. Ideally, this would be in JSON format.

    enhancement 
    opened by nathan-osman 0
  • When converting text to HTML, create links where appropriate

    When converting text to HTML, create links where appropriate

    Currently, if the html parameter is not supplied, the text content is HTML-escaped and newlines replaced with <br>. It would be nice if anything looking like a URL was also converted to an <a> link.

    enhancement 
    opened by nathan-osman 0
  • Email has wrong Content-Type header

    Email has wrong Content-Type header

    I'm using https://github.com/hectane/wordpress-hectane to power a contact form on my website.

    It's generating emails like the following

    Content-Type: text/plain; charset=utf-8
    
    --03188fce48023ba34a4e459e471c59e0ca9deffbdaea8b926ed6e57dacd7
    Content-Type: multipart/alternative; boundary=b972600c5117462370a40eeacdb3c0553d2c1ff177e5366b9bf6acb18302
    
    --b972600c5117462370a40eeacdb3c0553d2c1ff177e5366b9bf6acb18302
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain; charset=utf-8
    
    --- Name ---
    
    testing
    
    --- Email ---
    
    [email protected]
    
    --- Comment or Message ---
    
    testing
    
    
    
    Time: 11/29/2020
    IP: <ip>
    --b972600c5117462370a40eeacdb3c0553d2c1ff177e5366b9bf6acb18302
    Content-Type: text/html; charset=utf-8
    Content-Transfer-Encoding: quoted-printable
    
    --- Name ---<br><br>testing<br><br>--- Email ---<br><br>[email protected]<br><b=
    r>--- Comment or Message ---<br><br>testing<br><br><br><br>Time: 11/29/2020=
    <br>IP: <ip>
    --b972600c5117462370a40eeacdb3c0553d2c1ff177e5366b9bf6acb18302--
    
    --03188fce48023ba34a4e459e471c59e0ca9deffbdaea8b926ed6e57dacd7--
    

    03188fce48023ba34a4e459e471c59e0ca9deffbdaea8b926ed6e57dacd7 isn't mentioned anywhere else in the headers. Based on https://github.com/hectane/hectane/blob/master/email/email.go#L40, the Content-Type is supposed to be multipart/mixed, likely mentioning the extra boundary. How can I figure out where the Content-Type header is being dropped?

    opened by JeffreyFalgout 2
  • Hectane does not deliver mail: Cannot connect to SMTP servers.

    Hectane does not deliver mail: Cannot connect to SMTP servers.

    I learned about hectane from https://github.com/docker-library/wordpress/issues/30#issuecomment-145320414.

    I installed the WordPress plugin, and have the following service in my docker-compose.yml:

        mail:
            image: hectane/hectane:0.3.1
            environment:
                LOGFILE: /dev/stderr
                DEBUG: 1
            volumes:
                - mail:/data
            networks:
                - external
    

    WordPress successfully queues mail with hectane:

    $ ls -la $(docker volume inspect website_mail --format {{.Mountpoint}})
    total 12
    drwxr-xr-x 3 root root 4096 Sep 12 00:40 .
    drwxr-xr-x 3 root root 4096 Sep 12 00:39 ..
    drwx------ 2 root root 4096 Sep 12 00:40 6708342d-b706-499a-b51e-69dca2499388
    

    But hectane cannot connect to the SMTP servers:

    $ docker logs $(docker container ls --filter name=mail --format {{.Names}})
    time="2019-09-12T00:51:45Z" level=info msg="loaded 1 message(s) from /data" context=Queue 
    time="2019-09-12T00:51:45Z" level=info msg="message received in queue" context=<my domain>
    time="2019-09-12T00:51:45Z" level=debug msg="connecting to mail server" context=<my domain>
    time="2019-09-12T00:51:45Z" level=debug msg="unable to connect to gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:51:47Z" level=debug msg="unable to connect to alt1.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:51:48Z" level=debug msg="unable to connect to alt2.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:51:48Z" level=debug msg="unable to connect to alt3.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:51:49Z" level=debug msg="unable to connect to alt4.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:51:49Z" level=error msg="unable to connect to a mail server" context=<my domain>
    time="2019-09-12T00:53:49Z" level=debug msg="connecting to mail server" context=<my domain>
    time="2019-09-12T00:53:49Z" level=debug msg="unable to connect to gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:53:51Z" level=debug msg="unable to connect to alt1.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:53:52Z" level=debug msg="unable to connect to alt2.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:53:52Z" level=debug msg="unable to connect to alt3.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:53:53Z" level=debug msg="unable to connect to alt4.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:53:53Z" level=error msg="unable to connect to a mail server" context=<my domain>
    time="2019-09-12T00:57:53Z" level=debug msg="connecting to mail server" context=<my domain>
    time="2019-09-12T00:57:53Z" level=debug msg="unable to connect to gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:57:55Z" level=debug msg="unable to connect to alt1.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:57:56Z" level=debug msg="unable to connect to alt2.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:57:56Z" level=debug msg="unable to connect to alt3.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:57:57Z" level=debug msg="unable to connect to alt4.gmr-smtp-in.l.google.com" context=<my domain>
    time="2019-09-12T00:57:57Z" level=error msg="unable to connect to a mail server" context=<my domain>
    

    What other setup is necessary to get hectane working?

    opened by JeffreyFalgout 1
  • What happens to mails in the queue that are rejected?

    What happens to mails in the queue that are rejected?

    Reading through the docs, I'm not sure what happens to emails in the queue that are rejected. Say the following happens:

    1. I start up hectane as a service.
    2. A client sends an email via POST /v1/send and gets an empty response back (success).
    3. Hectane sees the recipient's server is down and queues the mail.
    4. The recipient's mail server never comes back OR it comes back and rejects the email.
    5. ???

    How can the client find out what happened to the email? The GET /v1/status call doesn't seem to offer a way to check on an email - and there's no real ID we can use to do so.

    opened by lyda 1
  • Microsoft Outlook

    Microsoft Outlook

    How can I use this library to send email using Microsoft Outlook SMTP settings? Outlook SMTP settings: Server name: smtp.office365.com Port: 587 Encryption method: STARTTLS

    opened by amkgo 0
  • hectane/hectane-armhf:latest

    hectane/hectane-armhf:latest

    Error relocating /lib/ld-musl-armhf.so.1: RELRO protection failed: Invalid argument
    Error relocating /usr/local/bin/hectane: RELRO protection failed: Invalid argument

    opened by evgeni22 0
Releases(v0.3.2)
Owner
Hectane
Lightweight SMTP client written in Go.
Hectane
Web and API based SMTP testing

MailHog Inspired by MailCatcher, easier to install. Download and run MailHog Configure your outgoing SMTP server View your outgoing email in a web UI

MailHog 11.3k Jan 4, 2023
MailHog SMTP Protocol

MailHog SMTP Protocol github.com/mailhog/smtp implements an SMTP server state machine. It attempts to encapsulate as much of the SMTP protocol (plus i

MailHog 74 Oct 27, 2022
:incoming_envelope: Simple email interface across multiple service providers (ses, postmark, mandrill, smtp)

go-mail Lightweight email package with multi-provider support (ses, mandrill, postmark) Table of Contents Installation Documentation Examples & Tests

MrZ 41 Dec 10, 2022
envio de email via SMTP com anexo usando Go

gosendmail - SMTP This repo is a simple net/smtp abstraction for sending emails using SMTP. With it we can send emails With copy, with blind copy and

Jefferson Otoni Lima 9 Aug 18, 2022
Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

Inbucket 1.1k Jan 1, 2023
golang honeypot smtp server

honeygogo-smtp standalone honeypot A lightweight SMTP honeypot server written in Go, leveraging go-smtp. A stand alone version of a module from honeyg

jothflee 1 May 4, 2022
Simple SMTP Server for Testing

go-smtptester Simple SMTP Server for Testing. How it works All received mails are saved in a sync.Map with a key: From+Recipient1+Recipient2 Mails to

null 1 Nov 18, 2021
Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade

smtptest Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade All settings are configurable in the config.yaml file ser

Mario 1 Sep 19, 2022
Pretty wrapper for sending email using go net/smtp

Emailer A pretty wrapper around go net/smtp send multiple email using single client func main() { var client *emailer.Client var clientX sync.Mute

Vin. 1 Mar 23, 2022
IMAP4rev1 Client for Go

IMAP4rev1 Client for Go ======================= To download and install this package run: go get github.com/mxk/go-imap/imap The documentation is a

Maxim Khitrov 208 Nov 20, 2022
A simple Go POP3 client library for connecting and reading mails from POP3 servers.

go-pop3 A simple Go POP3 client library for connecting and reading mails from POP3 servers. This is a full rewrite of TheCreeper/go-pop3 with bug fixe

Kailash Nadh 44 Dec 17, 2022
POP-3 client package for Go.

GOP-3 (Go + POP-3) is a POP-3 client for Go. It has experimental purpose and it is still under development. RFC 1939 document has been followed while developing package.

Gökhan Özeloğlu 10 Dec 25, 2021
aerc is an email client for your terminal.

aerc aerc is an email client for your terminal. This is a fork of the original aerc by Drew DeVault. A short demonstration can be found on https://aer

Robin Jarry 21 Dec 14, 2022
Filtering spam in mail server, protecting both client privacy and server algorithm

HE Spamfilter SNUCSE 2021 "Intelligent Computing System Design Project" Hyesun Kwak Myeonghwan Ahn Dongwon Lee abstract Naïve Bayesian spam filtering

Myeonghwan Ahn 1 Mar 23, 2022
📧 Go client for the OhMySMTP email service

go-ohmysmtp A Go wrapper for the OhMySMTP email service. Package https://github.com/jackcoble/go-ohmysmtp Examples Send an email. package main impor

null 0 Dec 13, 2021
aerc is an email client for your terminal.

aerc aerc is an email client for your terminal. This is a fork of the original aerc by Drew DeVault. A short demonstration can be found on https://aer

null 1 Apr 16, 2022
go-pst is a library for reading PST files (written in Go/Golang).

go-pst A library for reading PST files (written in Go/Golang). Introduction go-pst is a library for reading PST files (written in Go/Golang). The PFF

Mooij Technologies 131 Dec 29, 2022
📮 Simple (but useful) email sender written in pure Go v1.17. Support HTML templates and attachments.

?? Go Email Sender Simple (but useful) email sender written in pure Go v1.17. Yes, yet another email package here! ?? Support HTML templates and attac

Vic Shóstak 6 Dec 31, 2021
An email service written in Golang

furion An email service written in Go. Architecture Diagram

NUSSU commIT 1 Dec 19, 2021