Graylog2 / Graylog2/graylog2-server
Email notification body without trailing newline can cause failed test notification
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
Minor bug that really only affects the `Execute Test Notification` part of an email notification. If an email notification body contains only JMTE formatted text, the substituted values are empty in the test notification (like `backlog`), and the template is not ended by a new line the templating engine fails to create the message body and the test notification fails to send.
In practice when the notification is executed this JMTE template _should_ have some replacement text there for the email to have anything in the body and it should work fine, but when testing the notification it can seem as though it is broken. See this [community post](https://community.graylog.org/t/send-an-email-just-with-the-message/30932) for context.
## Expected Behavior
A missing new line at the end of the body should not result in failed test notification
## Current Behavior
Missing new line at the end of an email notification body that only contains JMTE formatted text can fail to send test notification
## Possible Solution
Add a new line to email template body if it isn't there
## Steps to Reproduce (for bugs)
1. Create an email notification
2. Set the email body (with no trailing new line) to:
```
${foreach backlog message}
${message.message}
${end}
```
3. Execute Test Notification
4. Should see the error message `Error:
Notification has email recipients and is triggered, but sending emails failed. Invalid message supplied`
5. Add a trailing newline and execute the test notification
6. Should be successful
## Context
See community post linked above.
## Your Environment
* Graylog Version: 5.2.2
Contributor guide
Assessment
This issue has not been assessed yet.