Skip to content

[Bug]: 🐛 SMTP Email Failure: Invalid MAIL FROM Address | AWS SES #1857

@nstankov-bg

Description

@nstankov-bg

Issue Description

Problem

OpenSign fails to send emails via SMTP providers (AWS SES, SendGrid, etc.) with error:

501 Invalid MAIL FROM address provided

Log Entry

err in sendmailv3 Error: Mail command failed: 501 Invalid MAIL FROM address provided
    at SMTPConnection._formatError (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:809:19)
    at SMTPConnection._actionMAIL (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:1618:34)
    at SMTPConnection.<anonymous> (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:1087:18)
    at SMTPConnection._processResponse (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:993:20)
    at SMTPConnection._onData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:774:14)
    at SMTPConnection._onSocketData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) {
  code: 'EENVELOPE',
  response: '501 Invalid MAIL FROM address provided',
  responseCode: 501,
  command: 'MAIL FROM'
}

Root Cause

File: apps/OpenSignServer/cloud/parsefunction/sendMailv3.js (lines 110, 205)

Problematic code:

from: from + ' <' + mailsender + '>'  // Creates invalid email out of the api user

Why Only SMTP Users Affected

  • AWS SES SMTP uses an API key as a user, so the passed variable becomes a non RFC Compliant Email.

Solution

Add optional SMTP_MAIL_FROM environment variable and proper formatting:

Configuration

Add to env.prod and env.local_dev:

SMTP_MAIL_FROM=                   # Optional: Override MAIL FROM address for SES/SMTP

Impact

  • High: AWS SES users (emails completely broken)
  • Medium: Other strict SMTP providers

Expected Behavior

No response

Current Behavior

No response

Steps to reproduce

No response

Screenshots of the issue(optional)

No response

Operating System [e.g. MacOS Sonoma 14.1, Windows 11]

No response

What browsers are you seeing the problem on?

Chrome

What version of OpenSign™ are you seeing this issue on? [e.g. 1.0.6]

v2.26.0

What environment are you seeing the problem on?

Hosted (app.yourdomain.com)

Please check the boxes that apply to this issue report.

  • I have searched the existing issues & discussions to make sure that this is not a duplicate.

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I have searched the existing issues & discussions to make sure that this is not a duplicate.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions