Improved error handling for strange/invalid email addresses.

This commit is contained in:
Martin Edenhofer 2017-11-02 14:09:47 +01:00
parent 70a03d657e
commit b82b0375f0
2 changed files with 41 additions and 2 deletions

View file

@ -922,7 +922,7 @@ perform changes on ticket
ticket_id: id,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'email'),
).where("ticket_articles.created_at > ? AND ticket_articles.to LIKE '%#{recipient_email.strip}%'", Time.zone.now - minutes.minutes).count
).where('ticket_articles.created_at > ? AND ticket_articles.to LIKE ?', Time.zone.now - minutes.minutes, "%#{recipient_email.strip}%").count
next if already_sent < count
logger.info "Send no trigger based notification to #{recipient_email} because already sent #{count} for this ticket within last #{minutes} minutes (loop protection)"
skip = true
@ -941,7 +941,7 @@ perform changes on ticket
already_sent = Ticket::Article.where(
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'email'),
).where("ticket_articles.created_at > ? AND ticket_articles.to LIKE '%#{recipient_email.strip}%'", Time.zone.now - minutes.minutes).count
).where('ticket_articles.created_at > ? AND ticket_articles.to LIKE ?', Time.zone.now - minutes.minutes, "%#{recipient_email.strip}%").count
next if already_sent < count
logger.info "Send no trigger based notification to #{recipient_email} because already sent #{count} in total within last #{minutes} minutes (loop protection)"
skip = true

View file

@ -69,6 +69,45 @@ Some Textäöü",
},
},
},
{
data: "From: me@exampl'e.com
To: customer@exampl'e.com
Subject: äöü some subject
Some Textäöü",
channel: {
trusted: false,
},
success: true,
result: {
0 => {
priority: '2 normal',
title: 'äöü some subject',
},
1 => {
body: 'Some Textäöü',
sender: 'Customer',
type: 'email',
internal: false,
},
},
verify: {
users: [
{
firstname: '',
lastname: '',
fullname: 'me@exampl\'e.com',
email: 'me@exampl\'e.com',
},
{
firstname: '',
lastname: '',
fullname: 'customer@exampl\'e.com',
email: 'customer@exampl\'e.com',
},
],
},
},
{
data: "From: me@example.com
To: customer@example.com