[MGNLMAIL-125] Allow configuration of newer security protocols when sending emails Created: 29/Apr/22  Updated: 10/Aug/22  Resolved: 01/Jun/22

Status: Closed
Project: Magnolia Mail Module
Component/s: None
Affects Version/s: 5.5.11
Fix Version/s: 5.5.13

Type: Improvement Priority: Normal
Reporter: Mercedes Iruela Assignee: Chuong Doan Huy
Resolution: Fixed Votes: 0
Labels: cs-bk
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 4d 0.5h Time Spent: 3d 3h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Relates
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLMAIL-128 Implement Sub-task Completed Chuong Doan Huy  
MGNLMAIL-129 Review code Sub-task Closed Oanh Thai Hoang  
MGNLMAIL-130 piQA Sub-task Completed Javier Benito  
MGNLMAIL-131 Final QA Sub-task Completed Oanh Thai Hoang  
MGNLMAIL-132 DOCSub: Mention sslProtocols in secti... Sub-task Closed Martin Drápela  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Documentation update required:
Yes
Date of First Response:
Epic Link: Support
Sprint: DevX 11
Story Points: 5
Team: DeveloperX

 Description   

Using a Mail Server configured to use TLS v.1.2 (for example)

configure the following parameters:

servier: smtp.office365.com
port: 587
'Use STARTTLS'

This throws and error  'could not convert socket to TLS'.

Some mail servers are deprecating the use of SSL based protocols in favor of TLS, so it is not possible to use the Mail Module OOTB for that cases (see)

Workaround:

  1. Create a class that extends info.magnolia.module.mail.MailTemplate
  2. Override info.magnolia.module.mail.MailTemplate.initSession() method to add the following line in order to force version 1.2 of the protocol:
    props.put("mail.smtp.ssl.protocols", "TLSv1.2");
  3. Create a class that extends info.magnolia.module.mail.commands.MailCommand that uses the template created in steps 1 and 2 to create and send the email.

Proposed solution
Add one more property to smtpConfiguration named "sslProtocols" to allow user input their desired version. If this value exist, add it to property "mail.smtp.ssl.protocols" to use that version.



 Comments   
Comment by Chuong Doan Huy [ 30/May/22 ]

Hi mdrapela,
for documentation update, here is some information :
We added new property to smtpConfiguration called "sslProtocols". This will allow user to set their ssl protocols used, e.g "TLSv1.2". This property is optional and not displayed in the mail app.

Generated at Mon Feb 12 06:03:52 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.