Improved handling/parsing with invalid email addresses like "undisclosed-recipients: ;".

This commit is contained in:
Martin Edenhofer 2016-05-17 07:44:17 +02:00
parent ea82574877
commit 73ba902501

View file

@ -95,16 +95,17 @@ class App.TicketZoomArticleActions extends App.Controller
forgeinRecipients = [] forgeinRecipients = []
recipientUsed = {} recipientUsed = {}
for recipient in recipients for recipient in recipients
localRecipientAddeess = recipient.address.toString().toLowerCase() if !_.isEmpty(recipient.address)
if !recipientUsed[localRecipientAddeess] localRecipientAddeess = recipient.address.toString().toLowerCase()
recipientUsed[localRecipientAddeess] = true if !recipientUsed[localRecipientAddeess]
localAddess = false recipientUsed[localRecipientAddeess] = true
for address in localAddresses localAddess = false
if localRecipientAddeess is address.email.toString().toLowerCase() for address in localAddresses
recipientUsed[localRecipientAddeess] = true if localRecipientAddeess is address.email.toString().toLowerCase()
localAddess = true recipientUsed[localRecipientAddeess] = true
if !localAddess localAddess = true
forgeinRecipients.push recipient if !localAddess
forgeinRecipients.push recipient
# check if reply all is neede # check if reply all is neede
if forgeinRecipients.length > 1 if forgeinRecipients.length > 1
@ -289,7 +290,7 @@ class App.TicketZoomArticleActions extends App.Controller
# filter for uniq recipients # filter for uniq recipients
recipientAddresses = {} recipientAddresses = {}
recipient = emailAddresses.parseAddressList(articleNew.to) recipient = emailAddresses.parseAddressList(articleNew.to)
if recipient && recipient[0] if recipient && recipient[0] && !_.isEmpty(recipient[0].address)
recipientAddresses[ recipient[0].address.toString().toLowerCase() ] = true recipientAddresses[ recipient[0].address.toString().toLowerCase() ] = true
if all if all
addAddresses = (lineNew, addressLine) -> addAddresses = (lineNew, addressLine) ->
@ -297,12 +298,12 @@ class App.TicketZoomArticleActions extends App.Controller
recipients = emailAddresses.parseAddressList(addressLine) recipients = emailAddresses.parseAddressList(addressLine)
if recipients if recipients
for recipient in recipients for recipient in recipients
if recipient.address if !_.isEmpty(recipient.address)
# check if addess is not local # check if addess is not local
localAddess = false localAddess = false
for address in localAddresses for address in localAddresses
if recipient.address.toString().toLowerCase() == address.email.toString().toLowerCase() if !_.isEmpty(recipient.address) && recipient.address.toString().toLowerCase() == address.email.toString().toLowerCase()
localAddess = true localAddess = true
if !localAddess if !localAddess