Open krisavi opened 3 years ago
Hi and thanks for reporting this.
Two quick questions. Is this a regression?
Second, can you please test this on the latest code just to be sure and confirm it is still there?
It seems to be in the code since it's creation. Seems to be in there even in develop as you can follow links below to see in current code base https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L997 https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L1082
On local copy I replaced in /opt/Rocket.Chat/programs/server/app/app.js the following:
let fromEmail = settings.get('From_Email').match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i);
if (fromEmail) {
fromEmail = fromEmail[0];
} else {
fromEmail = settings.get('From_Email');
}
to
let fromEmail = settings.get('From_Email')
Restarted the service and it worked fine.
Problem seems to be still there:
let fromEmail = settings.get('From_Email').match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i);
The main issue there is [A-Z]{2,4} that limits the TLD to 2 to 4 characters and will not work with a lot of domains added with https://icannwiki.org/New_gTLD_Program
Since some lines have changed in the file the lines are currently: https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L1075 and https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L1176
Description:
The transcript From: email gets parts cut off or mail is not sent when TLD should be longer than 4 char (like .casino, .luxury, .photo, .photography, .consulting, etc) Part is getting cut off from something like
rocketchat@subdomain.dmn.photo
and ends up beingrocketchat@subdomain.dmn
The regexp to check the e-mail does not support for TLD-s that can be longer than 4 characters due to this issue it cuts off the last part of "From: " if using something like subdomain.domain.photo.
Steps to reproduce:
Expected behavior:
Full From: address in e-mail headers
Actual behavior:
TLD is being cut off if domain part is short like 3-4 char.
Server Setup Information:
Server info irrelevant, as issue is in code base from it's creation commit.
Client Setup Information
Client info irrelevant, as issue is in code base from it's creation commit.
Additional context
Errors located here in regexp! https://github.com/RocketChat/Rocket.Chat/blob/157b882d38b34b7b79dea527316554fe33f70891/app/livechat/server/lib/Livechat.js#L994
https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L997
https://github.com/RocketChat/Rocket.Chat/blob/157b882d38b34b7b79dea527316554fe33f70891/app/livechat/server/lib/Livechat.js#L1079
https://github.com/RocketChat/Rocket.Chat/blob/develop/app/livechat/server/lib/Livechat.js#L1082
Relevant logs:
N/A It is code error, location pointed out to you above.