[Solved] Can't have plus sign in from email address

Summary

Error when putting + sign in from email address, I get an error.

Steps to reproduce

Mattermost Version: dev-linux-arm-v5.30.1
Database Schema Version: 5.30.0
Database: mysql

Running on Raspberrypios lite on a Raspberrypi Pi 4

Server downloaded from https://github.com/SmartHoneybee/ubiquitous-memory/releases/tag/v5.30.1

In the system console, set the Notification From Address in Site Configuration>Notifactions to an email address with a plus sign (+) (such as +mmnotify@ in it. Go to SMTP settings (Enviroment>SMTP), set the SMTP settings, and click Test Connection.

Expected behavior

There should be a message saying that the connection was successful.

Observed behavior

The following error shows.

Connection unsuccessful: Connection unsuccessful: SendMail: Failed to close connection to SMTP server., 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0C040000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:5D020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:62020000, 1.44866:80010000, 16.55847:48040000, 17.43559:0000000024020000000000000300000000000000, 20.52176:140F898E13004010F1030000, 20.50032:140F898E83174010F1030000, 0.35180:00000000, 255.23226:00000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:F1030000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:56000000, 1.36674:32000000, 1.61250:00000000, 1.45378:5B000000, 1.44866:01000000, 16.55847:C2000000, 17.43559:0000000080030000000000000000000000000000, 20.52176:140F898E130010100A000000, 20.50032:140F898E8317101002000000, 0.35180:4D1E0000, 255.23226:0A000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:B3180000, 0.38698:05000780, 0.37692:01000000, 0.37948:0F010480, 5.33852:00000000534D545000010480, 7.36354:010000000000010900000000, 4.56248:DC040000, 7.40748:010000000000010B30364D42, 7.57132:0000000000000000632D3938, 1.63016:32000000, 4.39640:DC040000, 8.45434:0140030025D8D61000000000000000000F010480, 1.46798:04000000, 5.10786:0000000031352E32302E333732312E3031393A414D36505230364D42353336363A39623637366339632D393833662D343838352D626564622D6566363337363565663637633A31353338323000D3201000000000, 7.51330:65DBBF1FC5ADD80818000000, 0.39570:00000000, 1.55954:0A000000, 0.49266:02000000, 1.33010:0A000000, 2.54258:00000000, 0.40002:7A000000, 1.56562:00000000, 1.64146:32000000, 1.33010:32000000, 2.54258:DC040000, 255.1750:B4000000, 255.31418:B4000000, 0.22753:0A00F565, 255.21817:DC040000, 0.64418:B9000000, 4.39842:DC040000, 0.41586:BE000000, 4.60547:DC040000, 0.21966:0A006136, 4.30158:DC040000 [Hostname=AM6PR06MB5366.eurprd06.prod.outlook.com]

This also shows in the log.

{"level":"error","ts":1609444142.717715,"caller":"mlog/log.go:229","msg":"Connection unsuccessful: SendMail: Failed to close connection to SMTP server., 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0C040000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:5D020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:62020000, 1.44866:80010000, 16.55847:48040000, 17.43559:0000000024020000000000000300000000000000, 20.52176:140F898E13004010F1030000, 20.50032:140F898E83174010F1030000, 0.35180:00000000, 255.23226:00000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:F1030000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:56000000, 1.36674:32000000, 1.61250:00000000, 1.45378:5B000000, 1.44866:01000000, 16.55847:C2000000, 17.43559:0000000080030000000000000000000000000000, 20.52176:140F898E130010100A000000, 20.50032:140F898E8317101002000000, 0.35180:4D1E0000, 255.23226:0A000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:B3180000, 0.38698:05000780, 0.37692:01000000, 0.37948:0F010480, 5.33852:00000000534D545000010480, 7.36354:010000000000010900000000, 4.56248:DC040000, 7.40748:010000000000010B30364D42, 7.57132:0000000000000000632D3938, 1.63016:32000000, 4.39640:DC040000, 8.45434:0140030025D8D61000000000000000000F010480, 1.46798:04000000, 5.10786:0000000031352E32302E333732312E3031393A414D36505230364D42353336363A39623637366339632D393833662D343838352D626564622D6566363337363565663637633A31353338323000D3201000000000, 7.51330:65DBBF1FC5ADD80818000000, 0.39570:00000000, 1.55954:0A000000, 0.49266:02000000, 1.33010:0A000000, 2.54258:00000000, 0.40002:7A000000, 1.56562:00000000, 1.64146:32000000, 1.33010:32000000, 2.54258:DC040000, 255.1750:B4000000, 255.31418:B4000000, 0.22753:0A00F565, 255.21817:DC040000, 0.64418:B9000000, 4.39842:DC040000, 0.41586:BE000000, 4.60547:DC040000, 0.21966:0A006136, 4.30158:DC040000 [Hostname=AM6PR06MB5366.eurprd06.prod.outlook.com]","path":"/api/v4/email/test","request_id":"y843qn9q6jf3ig1p1oz4msgz3h","ip_addr":"127.0.0.1","user_id":"g93fewtpdtrk5cz3cze1qy6yqo","method":"POST","err_where":"testEmail","http_code":500,"err_details":""}


@ahmaddanial do you think that this would be an issue in the API of the mailing client, not parsing out special characters properly, or possibly an email-client side issue?
If it’s more likely a Mattermost issue, I’d be willing to do my best to break my own instance to find the same error!

I would like to mention after doing a bit of testing a little while back, that when clicking the support email in the footer (which also has a +), the to field is missing the + sign (as can be seen in the image.

@ahmaddanial I’m wondering if this could be an issue of the + sign needing to be escaped?

Hi, @XxLilBoPeepsxX

Sorry that it slipped off my radar earlier. I am gonna test it on my end. Thanks again for the mention.

1 Like

Your all good! Just was wondering, I was going to see if it had been tested already and see if I could get it to reproduce if it hadn’t! No worries!

I did find this in user_settings-general.tsx in the gitlab repro (github has a habbit of crashing my phone) to see if I can find the issue.

submitEmail = () => {
        const user = Object.assign({}, this.props.user);
        const email = this.state.email.trim().toLowerCase();
...
}

I wonder if the .trim might be causing issues (assuming this is also used in the smtp settings page which I can’t find the source for). I doubt it as in the language I work in the most (c#), .trim just removes excess spaces. But C# isn’t react.js.

1 Like

Hello, @minecraftchest1

I believe that this is a office365 specific issue which stems from the different to and from in your Notification settings.

With reference to the this article, can you ensure that Notification From Address and Notification Reply-To Address is the same and click on the Test Connection button again?

Setting the from and reply-to email’s to the same address <myoutlookusername>+mattermost@outlook.com, and the smtp username to @outlook.com` gives the following. I’ll try using my primary email rather then the alias I set up through to see if that solves it.


Edit: Same thing when using my primary email.

1 Like

I forgot to update this, but when sending an email with a decent email client (k9 on my android) with a similar setup as with mattermost, I get a similar error. It appears to be an outlook issue then. Thank’s for the support.

2 Likes

Hello, @minecraftchest1

Thanks for sharing the root cause to the problem. Hope you will be able to get it sorted out from your end soon.

1 Like