Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1115813 - [Enhancement] An email sent from JBoss ON using custom java mail server is not delivered because setFrom() is not set in JON MimeMessage
[Enhancement] An email sent from JBoss ON using custom java mail server is no...
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server (Show other bugs)
JON 3.2,JON 3.2.1
Unspecified Unspecified
unspecified Severity high
: DR01
: JON 3.3.0
Assigned To: Heiko W. Rupp
Mike Foley
: Triaged
Depends On: 1115815
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-03 03:48 EDT by bkramer
Modified: 2014-12-11 08:59 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
An issue with the JBoss ON server not including setFrom() in the MimeMessage from messages sent through the custom Java mail server caused emails not to be delivered. The only way to workaround the issue was to relax the SMTP policy in the custom mail server in cases when email comes from the JBoss ON server. The fix now sets the From address correctly using setFrom() before the message is sent through the custom Java mail server. Emails can now be correctly sent.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-12-11 08:59:27 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 971523 None None None Never

  None (edit)
Description bkramer 2014-07-03 03:48:44 EDT
Description of problem:
An email sent from JBoss ON using custom java mail server is not delivered because setFrom() is not set in JON MimeMessage

Version-Release number of selected component (if applicable):
JBoss ON 3.2.x

How reproducible:
Always

Steps to Reproduce:
1. When JBoss ON sends an email, From address is not set [1] and it should be according to the javadoc of javax.mail package [2].
2. Custom SMTP server, will not deliver email where From address is not set.
3.

Actual results:
When custom SMTP server is used, emails from JON server will not be delivered.

Expected results:
Emails from JON server are properly delivered when custom SMTP server is used.

Additional info:
[1]
**************************************************************************
public Collection<String> sendEmail(Collection<String> toAddresses, String messageSubject, String messageBody) {

        MimeMessage mimeMessage = new MimeMessage(mailSession);
        try {
            mimeMessage.setSubject(messageSubject);
            mimeMessage.setContent(messageBody, "text/plain");
        } catch (MessagingException e) {
            e.printStackTrace(); // TODO: Customise this generated block
            return toAddresses;
        }

        Exception error = null;
        Collection<String> badAdresses = new ArrayList<String>(toAddresses.size());

        // Send to each recipient individually, do not throw exceptions until we try them all
        for (String toAddress : toAddresses) {
            try {
                LOG.debug("Sending email [" + messageSubject + "] to recipient [" + toAddress + "]");
                InternetAddress recipient = new InternetAddress(toAddress);
                Transport.send(mimeMessage, new InternetAddress[] { recipient });
            } catch (Exception e) {
                LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]: "
                    + e.getMessage());
                badAdresses.add(toAddress);

                // Remember the first error - in case its due to a session initialization problem,
                // we don't want to lose the first error.
                if (error == null) {
                    error = e;
                }
            }
        }

        if (error != null) {
            LOG.error("Sending of emails failed for this reason: " + error.getMessage());
        }

        return badAdresses;
    }
**************************************************************************


[2] http://docs.oracle.com/javaee/6/api/javax/mail/package-summary.html
Comment 1 Heiko W. Rupp 2014-07-03 06:06:06 EDT
Proposing for 3.2.3, as this is already fixed in master 48c6a2e9
Comment 4 Jay Shaughnessy 2014-07-28 15:24:51 EDT
Now that it's 3.3 assigning to hrupp and setting modified as it's already in the release branch.
Comment 5 Simeon Pinder 2014-07-31 11:51:40 EDT
Moving to ON_QA as available to test with brew build of DR01: https://brewweb.devel.redhat.com//buildinfo?buildID=373993
Comment 7 Jared MORGAN 2014-10-29 01:59:36 EDT
I'm a little confused here. The KBase suggests that the issue is when JON send

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