[GH-ISSUE #499] SMTP MAIL command not respected #324

Closed
opened 2026-03-15 13:53:00 +03:00 by kerem · 2 comments
Owner

Originally created by @VikingPingvin on GitHub (May 23, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/499

I'm using Mailpit in an integration test for my Go application as an SMTP server.

I'm using Go's built-in smtp package and issuing a MAIL SMTP command (https://pkg.go.dev/net/smtp#Client.Mail) , where I set the sender address (from).

However, Mailpit reports [ Unknown ] in the From field after receiving the message.

I'd expect it to report the address I set using the SMTP MAIL command.

Am I doing something wrong?

(FROM is working fine if I'm including it in the message payload, but that is not what I want to do here)

Originally created by @VikingPingvin on GitHub (May 23, 2025). Original GitHub issue: https://github.com/axllent/mailpit/issues/499 I'm using Mailpit in an integration test for my Go application as an SMTP server. I'm using Go's built-in smtp package and issuing a `MAIL` SMTP command ([https://pkg.go.dev/net/smtp#Client.Mail](https://pkg.go.dev/net/smtp#Client.Mail)) , where I set the sender address (from). However, Mailpit reports `[ Unknown ]` in the `From` field after receiving the message. I'd expect it to report the address I set using the SMTP MAIL command. Am I doing something wrong? (FROM is working fine if I'm including it in the message payload, but that is not what I want to do here)
kerem closed this issue 2026-03-15 13:53:06 +03:00
Author
Owner

@axllent commented on GitHub (May 23, 2025):

Hi @VikingPingvin.

FROM is working fine if I'm including it in the message payload, but that is not what I want to do here

Sorry, I'm not exactly sure what it is you are trying to do here. The From in Mailpit is the From address stated in the email header. If this is missing in the payload, then it is "unknown" (not specified). As I understand it, the From you are setting in the Go SMTP module is effectively the Return-Path you are telling the SMTP server to bounce emails to - they are two separate things.

From: Sender name <sender@example.com>
To: Recipient <recipient@example.com>
Subject: This is the subject

This is the body of the message
<!-- gh-comment-id:2904226816 --> @axllent commented on GitHub (May 23, 2025): Hi @VikingPingvin. > FROM is working fine if I'm including it in the message payload, but that is not what I want to do here Sorry, I'm not exactly sure what it is you are trying to do here. The `From` in Mailpit is the `From` address stated in the email header. If this is missing in the payload, then it is "unknown" (not specified). As I understand it, the `From` you are setting in the Go SMTP module is effectively the `Return-Path` you are telling the SMTP server to bounce emails to - they are two separate things. ``` From: Sender name <sender@example.com> To: Recipient <recipient@example.com> Subject: This is the subject This is the body of the message ```
Author
Owner

@VikingPingvin commented on GitHub (May 23, 2025):

Hi @axllent , thanks for the quick reply.

You are right, I confused the two and I just needed to research a bit more in the topic.

Apologies and all the best to you!

<!-- gh-comment-id:2904245039 --> @VikingPingvin commented on GitHub (May 23, 2025): Hi @axllent , thanks for the quick reply. You are right, I confused the two and I just needed to research a bit more in the topic. Apologies and all the best to you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#324
No description provided.