Sending Email
Holamail is a lightweight SMTP listener. It accepts the basic SMTP commands HELO/EHLO, MAIL FROM, RCPT TO, DATA, and QUIT, then logs the message. It does not deliver email to external recipients.
Connection Details
| Parameter | Public test host | Local instance |
|---|---|---|
| Host | smtp.testmail.hola.cloud |
localhost |
| Port | 25 |
2525 |
| Encryption | None | None |
| Authentication | None | None |
Holamail does not support STARTTLS or SMTP AUTH.
SMTP Protocol Flow
The raw SMTP conversation follows this sequence:
1HELO client.example.com
2MAIL FROM:<noreply@example.com>
3RCPT TO:<user@example.com>
4DATA
5Subject: Hello from Holamail
6
7This message will be logged by Holamail.
8.
9QUIT
Examples
Using curl
curl --url smtp://smtp.testmail.hola.cloud:25 \
--mail-from noreply@example.com \
--mail-rcpt user@example.com \
--upload-file email.txtGET / HTTP/1.1
Host: smtp.testmail.hola.cloud:25
// Go 1.21+, standard library only. Save as main.go and run: go run main.go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "smtp://smtp.testmail.hola.cloud:25", nil)
if err != nil {
panic(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(resp.Status)
fmt.Println(string(responseBody))
}
<?php
// PHP 8+ with the curl extension. Save as example.php and run: php example.php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'smtp://smtp.testmail.hola.cloud:25',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $response, "\n";
curl_close($ch);
# Python 3.8+. Install: pip install requests. Save as example.py and run: python example.py
import requests
response = requests.request(
"GET",
"smtp://smtp.testmail.hola.cloud:25"
)
print(response.status_code)
print(response.text)
// Node.js 18+. Save as example.mjs and run: node example.mjs
const response = await fetch("smtp://smtp.testmail.hola.cloud:25", {
method: "GET"
});
console.log(response.status);
console.log(await response.text());
const response = await fetch("smtp://smtp.testmail.hola.cloud:25", {
method: "GET"
});
console.log(response.status);
console.log(await response.text());
// Java 17+, standard library only. Save as Main.java and run: java Main.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("smtp://smtp.testmail.hola.cloud:25"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}Where email.txt contains:
1Subject: Hello from Holamail
2
3This message will be logged by Holamail.
Plain TCP Session
1telnet localhost 2525
Then enter:
1HELO client.example.com
2MAIL FROM:<noreply@example.com>
3RCPT TO:<user@example.com>
4DATA
5Subject: Local Holamail test
6
7Hello from a local Holamail listener.
8.
9QUIT
Using Go's net/smtp
1package main
2
3import (
4 "log"
5 "net/smtp"
6)
7
8func main() {
9 to := []string{"user@example.com"}
10 msg := []byte("To: user@example.com\r\n" +
11 "Subject: Hello from Holamail\r\n" +
12 "\r\n" +
13 "This message will be logged by Holamail.\r\n")
14
15 err := smtp.SendMail("smtp.testmail.hola.cloud:25", nil,
16 "noreply@example.com", to, msg)
17 if err != nil {
18 log.Fatal(err)
19 }
20}
Using Python's smtplib
1import smtplib
2from email.message import EmailMessage
3
4msg = EmailMessage()
5msg.set_content("This message will be logged by Holamail.")
6msg["Subject"] = "Hello from Holamail"
7msg["From"] = "noreply@example.com"
8msg["To"] = "user@example.com"
9
10with smtplib.SMTP("smtp.testmail.hola.cloud", 25) as server:
11 server.send_message(msg)
Expected Behavior
Holamail accepts syntactically valid SMTP input and logs the message. It is useful for confirming that an application can speak SMTP without sending real email.
Unsupported features include external delivery, HTTP APIs, STARTTLS, AUTH, rate limiting, templates, analytics, and tracking.
Comments