branch develop updated (466676f1 -> 2df99596)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 466676f1 - fixes #10077 : Les pages dans l'aperçu PDF ne sont pas dans le bon ordre new 2df99596 - partial fix #10000 : problème de caractère dans émetteur/récepteur The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 2df995969cd0a2ff463b0064d0fd306fef2455f1 Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 5 11:15:22 2018 +0200 - partial fix #10000 : problème de caractère dans émetteur/récepteur Summary of changes: .../faxtomail/services/FaxToMailServiceUtils.java | 12 ++++++++++++ .../faxtomail/services/FaxToMailServiceUtilsTest.java | 17 +++++++++++++++++ .../franciaflex/faxtomail/web/job/MailFilterJob.java | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 2df995969cd0a2ff463b0064d0fd306fef2455f1 Author: jcouteau <couteau@codelutin.com> Date: Wed Sep 5 11:15:22 2018 +0200 - partial fix #10000 : problème de caractère dans émetteur/récepteur --- .../faxtomail/services/FaxToMailServiceUtils.java | 12 ++++++++++++ .../faxtomail/services/FaxToMailServiceUtilsTest.java | 17 +++++++++++++++++ .../franciaflex/faxtomail/web/job/MailFilterJob.java | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java index cf2e62ca..9f79279b 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java @@ -171,6 +171,18 @@ public class FaxToMailServiceUtils { return subject; } + public static String getDecodedFrom(String from) throws UnsupportedEncodingException { + Preconditions.checkNotNull(from); + System.setProperty("mail.mime.decodetext.strict", "false"); + + if (from.startsWith("=?iso-")) { + //from = from.replaceAll(" ", "=20"); + from = MimeUtility.decodeText(from); + } + + return from; + } + public static String getDomainForEmailAddress(String emailAddress) { Preconditions.checkNotNull(emailAddress); return emailAddress.substring(emailAddress.lastIndexOf("@") + 1); diff --git a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtilsTest.java b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtilsTest.java index eaf3e78a..4f5d85c1 100644 --- a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtilsTest.java +++ b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtilsTest.java @@ -65,4 +65,21 @@ public class FaxToMailServiceUtilsTest { Assert.fail(e.getMessage()); } } + + @Test + public void testDecodeFrom() { + try { + //String from = "=?iso-8859-1?b?qkfjrsbpvuvtvcbo?= =?iso-8859-1?b?qu5urvmgqkftu0ug?= =?iso-8859-1?b?r09vtefjtku=?= <agence.nantes@baie-ouest.fr>"; + //Assert.assertEquals("BAIE OUEST NANTES BASSE GOULAINE <agence.nantes@baie-ouest.fr>", FaxToMailServiceUtils.getDecodedFrom(from)); + + String from = "=?iso-8859-1?q?henri_seguin__mail_=3a_henri=2eseguin=40homkia=2efr_-_t=e9?= =?iso-8859-1?q?l_=3a_09_84_07_18_47?= <henri.seguin@homkia.fr>"; + Assert.assertEquals("henri seguin mail : henri.seguin@homkia.fr - tél : 09 84 07 18 47 <henri.seguin@homkia.fr>", FaxToMailServiceUtils.getDecodedFrom(from)); + + from = "Jean Couteau <couteau@codelutin.com>"; + Assert.assertEquals("Jean Couteau <couteau@codelutin.com>", FaxToMailServiceUtils.getDecodedSubject(from)); + + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } } \ No newline at end of file diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java index d00c9de5..bd56cd69 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java @@ -327,7 +327,7 @@ public class MailFilterJob extends AbstractFaxToMailJob { Address[] addresses = message.getFrom(); if (addresses != null && addresses.length > 0) { - String sender = addresses[0].toString(); + String sender = FaxToMailServiceUtils.getDecodedFrom(addresses[0].toString()); // some sender are like "toto tutu<toto.tutu73@gmail.com>" // the regex is to extract email address from it sender = sender.replaceFirst("^.*<(.*)>$", "$1"); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm