forked from Silverfish/proton-bridge
Fix sending error due to mixed case in sender address
This commit is contained in:
@ -251,6 +251,8 @@ func (su *smtpUser) Send(returnPath string, to []string, messageReader io.Reader
|
||||
return
|
||||
}
|
||||
|
||||
message.Sender.Address = pmapi.ConstructAddress(message.Sender.Address, addr.Email)
|
||||
|
||||
kr, err := su.client().KeyRingForAddressID(addr.ID)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
38
test/features/bridge/smtp/send/mixed_case.feature
Normal file
38
test/features/bridge/smtp/send/mixed_case.feature
Normal file
@ -0,0 +1,38 @@
|
||||
Feature: SMTP sending with mixed case address
|
||||
Background:
|
||||
Given there is connected user "user"
|
||||
And there is SMTP client logged in as "user"
|
||||
|
||||
Scenario: Mixed sender case in sender address
|
||||
When SMTP client sends message
|
||||
"""
|
||||
From: Bridge Test <[userAddress|capitalize]>
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then SMTP response is "OK"
|
||||
And mailbox "Sent" for "user" has messages
|
||||
| from | to | subject |
|
||||
| [userAddress] | bridgetest@protonmail.com | |
|
||||
And message is sent with API call
|
||||
"""
|
||||
{
|
||||
"Message": {
|
||||
"Subject": "",
|
||||
"Sender": {
|
||||
"Name": "Bridge Test"
|
||||
},
|
||||
"ToList": [
|
||||
{
|
||||
"Address": "bridgetest@protonmail.com",
|
||||
"Name": "Internal Bridge"
|
||||
}
|
||||
],
|
||||
"CCList": [],
|
||||
"BCCList": [],
|
||||
"MIMEType": "text/plain"
|
||||
}
|
||||
}
|
||||
"""
|
||||
@ -75,6 +75,7 @@ func (c *SMTPClient) SendCommands(commands ...string) *SMTPResponse {
|
||||
|
||||
for _, command := range commands {
|
||||
command = strings.ReplaceAll(command, "[userAddress]", c.address)
|
||||
command = strings.ReplaceAll(command, "[userAddress|capitalize]", strings.Title(c.address))
|
||||
|
||||
tstart := time.Now()
|
||||
|
||||
|
||||
@ -9,3 +9,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
### Removed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
CSB-331 Fix sending error due to mixed case in sender address.
|
||||
|
||||
Reference in New Issue
Block a user