SMTP Reference

Holamail implements a basic plain-SMTP listener. It accepts SMTP messages and logs them; it does not deliver mail externally.

Connection

Public test host:

1telnet smtp.testmail.hola.cloud 25

Local instance:

1telnet localhost 2525

STARTTLS and SMTP AUTH are not supported.

SMTP Commands

HELO / EHLO

Initiate the SMTP session.

1EHLO client.example.com

Typical response:

1250 Hello client.example.com

MAIL FROM

Specify the sender address.

1MAIL FROM:<noreply@example.com>

Typical response:

1250 OK

RCPT TO

Specify a recipient address.

1RCPT TO:<user@example.com>

Typical response:

1250 OK

DATA

Begin the message content. End with a line containing only a period (.).

1DATA

Typical response:

1354 End data with <CR><LF>.<CR><LF>

Then send headers and body:

1From: noreply@example.com
2To: user@example.com
3Subject: Holamail test
4
5This message will be logged by Holamail.
6.

Typical response:

1250 OK

QUIT

Terminate the SMTP session.

1QUIT

Typical response:

1221 Bye

Full SMTP Session Example

1printf 'EHLO client.example.com\r\nMAIL FROM:<noreply@example.com>\r\nRCPT TO:<user@example.com>\r\nDATA\r\nFrom: noreply@example.com\r\nTo: user@example.com\r\nSubject: Test\r\n\r\nHello!\r\n.\r\nQUIT\r\n' | nc localhost 2525

Example Go Code

 1package main
 2
 3import (
 4    "log"
 5    "net/smtp"
 6)
 7
 8func main() {
 9    from := "noreply@example.com"
10    to := []string{"user@example.com"}
11    msg := []byte("From: noreply@example.com\r\n" +
12        "To: user@example.com\r\n" +
13        "Subject: Holamail test\r\n\r\n" +
14        "This message will be logged by Holamail.\r\n")
15
16    if err := smtp.SendMail("smtp.testmail.hola.cloud:25", nil, from, to, msg); err != nil {
17        log.Fatal(err)
18    }
19}

Error Codes

Code Description
220 Service ready
221 Service closing transmission channel
250 Requested action completed
354 Start mail input
500 Syntax error or unrecognized command
502 Command not implemented
503 Bad command sequence

Scope

Holamail logs accepted messages only. It does not include external delivery, HTTP APIs, STARTTLS, AUTH, rate limiting, templates, analytics, or tracking.

Comments

Leave a comment