Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50284 Kernel email Message-ID must contain angle brackets #12720

Merged
merged 5 commits into from
Jul 19, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,9 @@ protected void sendMessageAndLog(InternetAddress[] to, long start, MimeMessage m
buf.append(" with ").append(parts.getCount() - 1).append(" attachments");
}
}
catch (IOException ioe) {}
catch (IOException ioe) {
log.debug("could not read message contents, {}", ioe);
}

if (log.isDebugEnabled())
{
Expand Down Expand Up @@ -1608,9 +1610,9 @@ else if (canUseCharset(message, CharacterSet.WINDOWS_1252) && canUseCharset(getS
/**
* Override MimeMessage Message-ID to use Sakai serverId instead of hostname
* https://javaee.github.io/javamail/FAQ#msgid
* @throws MessagingException
*/
protected void updateMessageID() throws MessagingException
*/
@Override
protected void updateMessageID() throws MessagingException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

{
StringBuilder s = new StringBuilder();
// Unique string is <hashcode>.<id>.<currentTime><suffix>
Expand All @@ -1621,10 +1623,11 @@ protected void updateMessageID() throws MessagingException
append(System.currentTimeMillis()).
append('@').
append(serverConfigurationService.getServerName());
setHeader("Message-ID", s.toString());
setHeader("Message-ID", "<" + s + ">");
}

protected void updateHeaders() throws MessagingException
@Override
protected void updateHeaders() throws MessagingException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

{
super.updateHeaders();
if (m_id != null)
Expand Down Expand Up @@ -1672,17 +1675,12 @@ private void addEncodedHeader(String header, String name) throws MessagingExcept
}
}
}
catch (MessagingException e)
{
log.error("Email.MyMessage: exception: " + e, e);
addHeaderLine(header);
}
catch (UnsupportedEncodingException e)
catch (MessagingException | UnsupportedEncodingException e)
{
log.error("Email.MyMessage: exception: " + e, e);
log.error("Email.MyMessage: exception: {}", e, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

addHeaderLine(header);
}
}
}
}

public String propName(String propNameTemplate)
Expand All @@ -1692,7 +1690,6 @@ public String propName(String propNameTemplate)

public String propName(String propNameTemplate, String protocol)
{
String formattedName = String.format(propNameTemplate, protocol);
return formattedName;
return String.format(propNameTemplate, protocol);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

}
}
Loading