[GH-ISSUE #294] Invalid from address #193

Closed
opened 2026-03-15 13:07:48 +03:00 by kerem · 10 comments
Owner

Originally created by @dejudicibus on GitHub (May 13, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/294

I installed mailpit and started it. I can see the MailPit interface on localhost:8025 as expected.
Then I created a file email.txt as follows

From: sender@example.com
To: recipient@example.com
Subject: Email Subject

This is the body of the email.
It can contain multiple lines of text.

but if I call MailPit as follows

mailpit sendmail < email.txt

I get the error message

invalid from address

and no messages in the browser interface. Changing the from address to ANY real or fake address makes no change.

Platform: Windows 10 Pro with WampServer 3.2.6 64bit

Originally created by @dejudicibus on GitHub (May 13, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/294 I installed mailpit and started it. I can see the MailPit interface on localhost:8025 as expected. Then I created a file email.txt as follows ``` From: sender@example.com To: recipient@example.com Subject: Email Subject This is the body of the email. It can contain multiple lines of text. ``` but if I call MailPit as follows ``` mailpit sendmail < email.txt ``` I get the error message ``` invalid from address ``` and no messages in the browser interface. Changing the from address to ANY real or fake address makes no change. Platform: Windows 10 Pro with WampServer 3.2.6 64bit
kerem 2026-03-15 13:07:48 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@axllent commented on GitHub (May 13, 2024):

That's really strange - I just tried with a copy/paste of your syntax and it works perfectly for me. I can't see any reason it would/should fail, unless potentially the txt file you created contains maybe some strange or unsupported hidden character encoding - what did you use to create the text file?

What happens if you try with this file? 1-test.txt

<!-- gh-comment-id:2107039896 --> @axllent commented on GitHub (May 13, 2024): That's really strange - I just tried with a copy/paste of your syntax and it works perfectly for me. I can't see any reason it would/should fail, unless potentially the txt file you created contains maybe some strange or unsupported hidden character encoding - what did you use to create the text file? What happens if you try with this file? [1-test.txt](https://github.com/axllent/mailpit/files/15292027/1-test.txt)
Author
Owner

@asuheel commented on GitHub (May 13, 2024):

I am also getting same error

invalid from address

Tried with 1-test.txt

Still same error

For refrence : I have done setup using docker-compose with this docker-compose.yaml

<!-- gh-comment-id:2107231956 --> @asuheel commented on GitHub (May 13, 2024): I am also getting same error `invalid from address` Tried with [1-test.txt](https://github.com/axllent/mailpit/files/15292027/1-test.txt) Still same error For refrence : I have done setup using docker-compose with this [docker-compose.yaml](https://mailpit.axllent.org/docs/install/docker/#docker-compose-example)
Author
Owner

@axllent commented on GitHub (May 13, 2024):

@bmunshi on what platform is the mailpit sendmail... being run? I assume for both of you that you're on a recent version of Mailpit too?

<!-- gh-comment-id:2108632484 --> @axllent commented on GitHub (May 13, 2024): @bmunshi on what platform is the `mailpit sendmail...` being run? I assume for both of you that you're on a recent version of Mailpit too?
Author
Owner

@dejudicibus commented on GitHub (May 14, 2024):

I found out what the problem was. If I call just mailpit I get the error.
To avoid the error I have to call

mailpit -s localhost:1025 -l localhost:8025

I thought that localhost was the default, whereas the default is 0.0.0.0 in both cases (1025 & 8025)

<!-- gh-comment-id:2110875137 --> @dejudicibus commented on GitHub (May 14, 2024): I found out what the problem was. If I call just `mailpit` I get the error. To avoid the error I have to call ``` mailpit -s localhost:1025 -l localhost:8025 ``` I thought that localhost was the default, whereas the default is 0.0.0.0 in both cases (1025 & 8025)
Author
Owner

@axllent commented on GitHub (May 15, 2024):

I am confused @dejudicibus - 0.0.0.0 means the Mailpit server should listen on all network interfaces which is the default (ie: not just to "localhost") which should work on Windows too, and the argument you are running is to start the Mailpit server, not to send messages via mailpit sendmail < email.txt (which is the issue you reported).

So mailpit -s localhost:1025 -l localhost:8025 starts mailpit and listens to "localhost" only (other machines in your network cannot connect), and mailpit sendmail < email.txt should then be able to send to Mailpit.

<!-- gh-comment-id:2111515146 --> @axllent commented on GitHub (May 15, 2024): I am confused @dejudicibus - `0.0.0.0` means the Mailpit server should **listen** on all network interfaces which is the default (ie: not just to "localhost") which should work on Windows too, and the argument you are running is to start the Mailpit server, not to send messages via `mailpit sendmail < email.txt` (which is the issue you reported). So `mailpit -s localhost:1025 -l localhost:8025` starts mailpit and listens to "localhost" only (other machines in your network cannot connect), and `mailpit sendmail < email.txt` should then be able to send to Mailpit.
Author
Owner

@axllent commented on GitHub (May 15, 2024):

@dejudicibus & @bmunshi - I have found the cause. When using sendmail in this way (without specifying a sender's email in the command with -f), it will automatically detect your username from the system. The issue here is that Windows returns the "user" in the format hostname\username - and \ is not a valid character in an email ~ so you get the error.

I have just pushed a fix (work-around) in v1.18.2 which will fix this issue for both of you. Please confirm this works for you? Thanks.

<!-- gh-comment-id:2111557451 --> @axllent commented on GitHub (May 15, 2024): @dejudicibus & @bmunshi - I have found the cause. When using sendmail in this way (without specifying a sender's email in the command with `-f`), it will automatically detect your username from the system. The issue here is that Windows returns the "user" in the format `hostname\username` - and `\` is not a valid character in an email ~ so you get the error. I have just pushed a fix (work-around) in [v1.18.2](https://github.com/axllent/mailpit/releases/tag/v1.18.2) which will fix this issue for both of you. Please confirm this works for you? Thanks.
Author
Owner

@axllent commented on GitHub (May 17, 2024):

@powerquell I don't think this is related to this issue at all. From what I see, your Mailpit requires authentication (250-AUTH LOGIN PLAIN), but you're not authenticating via telnet first before issuing theMAIL FROM.

<!-- gh-comment-id:2118282033 --> @axllent commented on GitHub (May 17, 2024): @powerquell I don't think this is related to this issue at all. From what I see, your Mailpit requires authentication (`250-AUTH LOGIN PLAIN`), but you're not authenticating via telnet first before issuing the`MAIL FROM`.
Author
Owner

@axllent commented on GitHub (May 17, 2024):

Ahh right - sorry @powerquell, that was not obvious from your original message. Your formatting is incorrect, try MAIL FROM:<test@example.com> - the SMTP protocol requires <> around the addresses (including RCPT TO) (see this).

<!-- gh-comment-id:2118354093 --> @axllent commented on GitHub (May 17, 2024): Ahh right - sorry @powerquell, that was not obvious from your original message. Your formatting is incorrect, try `MAIL FROM:<test@example.com>` - the SMTP protocol requires `<>` around the addresses (including `RCPT TO`) ([see this](https://www.rfc-editor.org/rfc/rfc5321.html#section-3.3)).
Author
Owner

@github-actions[bot] commented on GitHub (May 25, 2024):

This issue has been marked as stale because it has been open for 7 days with no activity.

<!-- gh-comment-id:2130654091 --> @github-actions[bot] commented on GitHub (May 25, 2024): This issue has been marked as stale because it has been open for 7 days with no activity.
Author
Owner

@github-actions[bot] commented on GitHub (May 28, 2024):

This issue was closed because there has been no activity since being marked as stale.

<!-- gh-comment-id:2134219363 --> @github-actions[bot] commented on GitHub (May 28, 2024): This issue was closed because there has been no activity since being marked as stale.
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#193
No description provided.