Bug 1934201 - ovirt-engine-notifier emails not sent unless MAIL_FROM is set
Summary: ovirt-engine-notifier emails not sent unless MAIL_FROM is set
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Services.Notifier
Version: 4.4.4.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.4.7
: 4.4.7.1
Assignee: Eli Mesika
QA Contact: Guilherme Santos
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-02 17:02 UTC by andy.taylor+rh
Modified: 2021-07-06 07:28 UTC (History)
2 users (show)

Fixed In Version: ovirt-engine-4.4.7.1
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-06 07:28:00 UTC
oVirt Team: Infra
Embargoed:
pm-rhel: ovirt-4.4+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 114889 0 master MERGED ovirt-notification: solve NPE in setFrom method 2021-06-02 12:05:56 UTC

Description andy.taylor+rh 2021-03-02 17:02:40 UTC
Description of problem:

The ovirt-engine-notifier fails to send emails unless MAIL_FROM is set in 90-email-notify.conf. This only seems to happen for me on a recent 4.4.4.7 installation - an older 4.3.7.2 installation successfully sends email even if MAIL_FROM is undefined.

In the /var/log/ovirt-engine/notifier/notifier.log I would see entries like this:

2021-03-02 12:45:46,841Z INFO    [org.ovirt.engine.core.notifier.transport.smtp.Smtp idle] Sending e-mail subject='alertMessage (ovirt-engine), [Migration started (VM: vm-ataylor, Source: vm-host-1, Destination: vm-host-2, User: ataylor@internal-authz). ]' to='user'

but I would never see an entry confirming the email had been successfully sent. MAIL_SERVER and MAIL_PORT were both set correctly (tested by connecting to that server/port via telnet on the oVirt Engine). The logs on the mail server and a tcpdump on port 25 showed nothing even attempting to connect.

After enabling debug mode in ovirt-engine-notifier and connecting an IDE to it, I found it was hitting a null pointer exception here:

https://github.com/oVirt/ovirt-engine/blob/ovirt-engine-4.4.4.7/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/smtp/Smtp.java#L211

As soon as I set MAIL_FROM and restarted ovirt-engine-notifier emails were sent successfully.

Version-Release number of selected component (if applicable):

4.4.4.7

How reproducible:

Always until MAIL_FROM is set.

Steps to Reproduce:

1. Follow the RHEV 4.4 documentation to configure event notifications and set up the notifier service:
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4/html/administration_guide/chap-event_notifications
2. Leave MAIL_FROM in 90-email-notify.conf as the default value (empty)
3. Trigger an event in oVirt which leads to a notification being sent.

Actual results:

The email notification is never sent.

Expected results:

An email notification is sent. Perhaps MAIL_FROM should be marked as a required value, but ovirt-engine-notifier seems to work without it being set in 4.3.x.

Additional info:

I don't know Java, but having done a bit of reading of the MimeMessage.setFrom documentation I thought this might have something to do with setFrom attempting to generate a from address from the local hostname. In case it was related I checked the oVirt Engine hostname/DNS configuration and it all seems fine, but perhaps there is an environmental issue.

Comment 1 RHEL Program Management 2021-04-22 08:48:15 UTC
The documentation text flag should only be set after 'doc text' field is provided. Please provide the documentation text and set the flag to '?' again.

Comment 3 Guilherme Santos 2021-06-29 17:18:43 UTC
Verified on:
ovirt-engine-4.4.7.5-0.9.el8ev.noarch

Steps:
1. configure event notifications and set up the notifier service:
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4/html/administration_guide/chap-event_notifications
2. Leave MAIL_FROM in 90-email-notify.conf as the default value (empty)
3. On UI, set up vm events for a specific user
4. Migrate a vm in with that user to Trigger an notification email

Results:
Email sent and received successfully with sender as: (unknown sender)

Comment 4 Sandro Bonazzola 2021-07-06 07:28:00 UTC
This bugzilla is included in oVirt 4.4.7 release, published on July 6th 2021.

Since the problem described in this bug report should be resolved in oVirt 4.4.7 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.