Defect #30785 » 30785-fix-v2.patch
| app/models/mail_handler.rb | ||
|---|---|---|
|
@handler_options = options
|
||
|
sender_email = email.from.to_a.first.to_s.strip
|
||
|
# Ignore emails received from the application emission address to avoid hell cycles
|
||
|
if sender_email.casecmp(Setting.mail_from.to_s.strip) == 0
|
||
|
emission_address = Setting.mail_from.to_s.gsub(/(?:.*<|>.*|\(.*\))/, '').strip
|
||
|
if sender_email.casecmp(emission_address) == 0
|
||
|
if logger
|
||
|
logger.info "MailHandler: ignoring email from Redmine emission address [#{sender_email}]"
|
||
|
end
|
||
| test/unit/mail_handler_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_should_ignore_emails_from_emission_address
|
||
|
emission_addresses = [
|
||
|
'redmine@example.net',
|
||
|
'Redmine <redmine@example.net>',
|
||
|
'redmine@example.net (Redmine)'
|
||
|
]
|
||
|
Role.anonymous.add_permission!(:add_issues)
|
||
|
assert_no_difference 'User.count' do
|
||
|
assert_equal false,
|
||
|
submit_email(
|
||
|
'ticket_from_emission_address.eml',
|
||
|
:issue => {:project => 'ecookbook'},
|
||
|
:unknown_user => 'create'
|
||
|
)
|
||
|
emission_addresses.each do |addr|
|
||
|
with_settings :mail_from => addr do
|
||
|
assert_no_difference 'User.count' do
|
||
|
assert_equal false,
|
||
|
submit_email(
|
||
|
'ticket_from_emission_address.eml',
|
||
|
:issue => {:project => 'ecookbook'},
|
||
|
:unknown_user => 'create'
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »