There is a bug in the getFromAddress function of the OutboundEmailAccounts module.
The function returns the SMTP User if it is a valid email address and the From address is not empty.
It also returns the SMTP User if it is not a valid email address if the From address actually is empty.
Expected Behavior
If the From email is empty, then the function should return the SMTP User only if it is a valid email address. Otherwise it should return the From address that was set.
Actual Behavior
The SMTP User is returned if it is a valid email address and a From address is set. If no From address is set, then the SMTP User will be returned even if it is not a valid email address. (see attached screenshot).
Possible Fix
An || operator was used instead of an && operator (as is the case in the getReplyToAddress function).
Create a new Outbound Email Account with the following details:
From Address: from@example.local (valid email address)
SMTP Username: smtp@example.local (valid email address)
Compose a new Email from the Email module and select the From dropdown (smtp@example.local is used)
Edit the same Outbound Email Account and set From Address to blank and change SMTP User to smtp.example.local (invalid email address)
Compose a new Email from the Email module and select the From dropdown (smtp.example.local is used)
Context
Cannot use the correct From address in an outbound email account.
Medium priority as it could impact on email deliverability.
Issue
There is a bug in the getFromAddress function of the OutboundEmailAccounts module.
The function returns the SMTP User if it is a valid email address and the From address is not empty. It also returns the SMTP User if it is not a valid email address if the From address actually is empty.
Expected Behavior
If the From email is empty, then the function should return the SMTP User only if it is a valid email address. Otherwise it should return the From address that was set.
Actual Behavior
The SMTP User is returned if it is a valid email address and a From address is set. If no From address is set, then the SMTP User will be returned even if it is not a valid email address. (see attached screenshot).
Possible Fix
An || operator was used instead of an && operator (as is the case in the getReplyToAddress function).
Steps to Reproduce
Context
Cannot use the correct From address in an outbound email account. Medium priority as it could impact on email deliverability.
Your Environment
Attachments