Skip to content

v6 fails with "No recipients" when "envelope_from" is set but not "envelope_to" #234

@gtjoseph

Description

@gtjoseph

We've been using action-send-email with Gmail for a few years with no issues. We recently needed to change over to using Amazon SES as our email gateway and encountered a few issues. These are most probably NOT action-send-email issues but changes here, at least for documentation, might help.

Gmail will accept a "from" value of user@domain.com but SES will not. It returns a 501 Invalid MAIL FROM address provided. As far as I can tell, this has nothing to do with this action or nodemailer but the investigation process discovered other things. As it turns out, SES will only accept a full User Name <user@domaon.com> as a "from" but I didn't know it at the time.

Since I had upgraded this action to v6, I decided to try using the "envelope_from" parameter but when I tried that, I got...

Run dawidd6/action-send-mail@v6
  with:
    server_address: email-smtp.us-east-1.amazonaws.com
    server_port: 587
    secure: false
    username: ***
    password: ***
    subject: Test via SES
    to: touser@domain.com
    from: fromuser@domain.com
    envelope_from: fromuser@domain.com
    body: test email
    reply_to: no-reply@domain.com
    ignore_cert: true
    convert_markdown: false
    nodemailerlog: true
    nodemailerdebug: true
  env:
    FROM_WF: from workflow
    FROM_JOB: from job
[2025-08-19 17:21:49] DEBUG Creating transport: nodemailer (7.0.3; +https://nodemailer.com/; SMTP/7.0.3[client:7.0.3])
[2025-08-19 17:21:49] DEBUG Sending mail using SMTP/7.0.3[client:7.0.3]
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] Resolved email-smtp.us-east-1.amazonaws.com as 3.224.1.122 [cache miss]
[2025-08-19 17:21:49] INFO  [PItaArrkPw4] Connection established to 3.224.1.122:587
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] S: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-4M3K4MGJE dxQQtLrFbQommQBdTVOZ
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] C: EHLO [127.0.0.1]
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] S: 250-email-smtp.amazonaws.com
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] S: 250-8BITMIME
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] S: 250-STARTTLS
<snip>
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] S: 250 Ok
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] SMTP handshake finished
[2025-08-19 17:21:49] DEBUG [PItaArrkPw4] C: AUTH PLAIN AEFL***XXXXXXXXXXXXXXXXXX
[2025-08-19 17:21:50] DEBUG [PItaArrkPw4] S: 235 Authentication successful.
[2025-08-19 17:21:50] INFO  [PItaArrkPw4] User "***" authenticated
[2025-08-19 17:21:50] INFO  Sending message <4db376ae-4676-e061-a068-427d454e10c7@domain.com> to <>
[2025-08-19 17:21:50] DEBUG [PItaArrkPw4] Closing connection to the server using "end"
[2025-08-19 17:21:50] ERROR Send error for <4db376ae-4676-e061-a068-427d454e10c7@domain.com>: No recipients defined
[2025-08-19 17:21:50] ERROR Send Error: No recipients defined

You can see that even though I supplied the "to" parameter, it wasn't used. GMail fails for the same reason.

So I decided to reverse it and supply "envelope_to" but not "envelope_from". SES responded with 501 Invalid MAIL FROM address provided

Run dawidd6/action-send-mail@v6
  with:
    server_address: email-smtp.us-east-1.amazonaws.com
    server_port: 587
    secure: false
    username: ***
    password: ***
    subject: Test via SES
    to: touser@doman.com
    from: From User <fromuser@domain.com>
    envelope_to: touser@doman.com
    body: test email
    reply_to: no-reply@domain.com
    ignore_cert: true
    convert_markdown: false
    nodemailerlog: true
    nodemailerdebug: true
  env:
    FROM_WF: from workflow
    FROM_JOB: from job
[2025-08-19 18:09:26] DEBUG Creating transport: nodemailer (7.0.3; +https://nodemailer.com/; SMTP/7.0.3[client:7.0.3])
[2025-08-19 18:09:26] DEBUG Sending mail using SMTP/7.0.3[client:7.0.3]
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] Resolved email-smtp.us-east-1.amazonaws.com as 54.157.237.25 [cache miss]
[2025-08-19 18:09:26] INFO  [89Tnb0Nhde4] Connection established to 54.157.237.25:587
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-XGMHWOHJE 9IV6g2ACpFKc5feLZT4K
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] C: EHLO [127.0.0.1]
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 250-email-smtp.amazonaws.com
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 250-8BITMIME
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 250-STARTTLS
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 250-AUTH PLAIN LOGIN
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 250 Ok
<snip>
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] SMTP handshake finished
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] C: AUTH PLAIN AEFL***XXXXXXXXXXXX==
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 235 Authentication successful.
[2025-08-19 18:09:26] INFO  [89Tnb0Nhde4] User "***" authenticated
[2025-08-19 18:09:26] INFO  Sending message <0edab02e-2386-3339-ee8b-2cb2a154dbc1@localhost> to <touser@doman.com>
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] C: MAIL FROM:<>
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] S: 501 Invalid MAIL FROM address provided
[2025-08-19 18:09:26] DEBUG [89Tnb0Nhde4] Closing connection to the server using "end"
[2025-08-19 18:09:26] ERROR Send error for <0edab02e-2386-3339-ee8b-2cb2a154dbc1@localhost>: Mail command failed: 501 Invalid MAIL FROM address provided
[2025-08-19 18:09:26] ERROR Send Error: Mail command failed: 501 Invalid MAIL FROM address provided

You can see that even though "from" was supplied, it wasn't used in the MAIL FROM command.

Now, this actually works fine for Gmail because even though nodemailer is sending C: MAIL FROM:<>, gmail will use the "From:" in the email body as the MAIL FROM if MAIL FROM was not supplied.

So the bottom line is that currently you have to supply both envelope_from or envelope_to unless you know that your MTA can tolerate an empty MAIL FROM:. Now the question is...was requiring both or none intentional by nodemailer or is it a bug? It's not documented explicitly in nodemailer's envelope docs but the doc does say that "envelope.to" is "Added to the RCPT TO list" but it appears that that's not the case.

OK so there are a few things you could do...

Document that you must supply both envelope_to and envelope_from or neither.

or

If one of the envelop_ parameters was not specified but the other was, default the missing one from the corresponding "to" or "from" parameter.

Sorry, this was a lot of information that boils down to something that was not really your issue. If I have time I may report it to nodemailer but time is tight right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions