Commons Email
  1. Commons Email
  2. EMAIL-132

Can't delivery to another recipients when send mail to one recipient failed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2, 1.3, 1.3.1
    • Fix Version/s: 1.3.2
    • Labels:
      None

      Description

      I want to send email to multiple recipients by using Email.addTo(). But I found when send mail to one recipient failed(e.g. email address invalid), another can't got the email. Here is Exception stack:

      09-17 07:48:48,804|ERROR|ortTask_tra_event_81| EmailUtils|Sending the email to the following server failed : xxxxx:xxxx
      org.apache.commons.mail.EmailException: Sending the email to the following server failed : 172.24.1.82:25
      at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)[131:org.apache.commons.email:1.2]
      at org.apache.commons.mail.Email.send(Email.java:1267)[131:org.apache.commons.email:1.2]
      at com.swimap.prs.utils.email.EmailUtils.sendEmail(EmailUtils.java:72)[125:prs.utils.common:1.9.8.1-SNAPSHOT]
      at com.swimap.prs.application.dataexport.impl.corbareport.traditional.event.ManualEventTask.run(ManualEventTask.java:48)[220:prs.application.dataexport.impl:1.9.8.1-SNAPSHOT]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_43]
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43]
      at com.swimap.prs.application.dataexport.impl.corbareport.traditional.event.ManualEventTask.run(ManualEventTask.java:48)[220:prs.application.dataexport.impl:1.9.8.1-SNAPSHOT]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_43]
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43]
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_43]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)[:1.6.0_43]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)[:1.6.0_43]
      at java.lang.Thread.run(Thread.java:662)[:1.6.0_43]
      Caused by: javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
      com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.1 Reason: Your Outlook settings may be incorrect, see http://xxxxx. Not allowed send to: asdkljfakld@kadjfka.com

      at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1873)[82:javax.mail:1.4.5]
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1120)[82:javax.mail:1.4.5]
      at javax.mail.Transport.send0(Transport.java:195)[58:javax.mail:1.4.4]
      at javax.mail.Transport.send(Transport.java:124)[58:javax.mail:1.4.4]
      at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)[131:org.apache.commons.email:1.2]
      ... 16 more
      Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.1 Reason: Your Outlook settings may be incorrect, see http://xxxxx. Not allowed send to: asdkljfakld@kadjfka.com

      at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1771)[82:javax.mail:1.4.5]
      ... 20 more

        Activity

        Hide
        Thomas Neidhart added a comment -

        Added in r1531110.

        Show
        Thomas Neidhart added a comment - Added in r1531110.
        Hide
        Thomas Neidhart added a comment -

        This should already be possible by doing the following:

        Email email = ....
        Session session = email.getSession();
        session.setProperty("mail.smtp.sendpartial", true);
        email.send();
        

        Ideally, the Email class should provide a "setSendPartial(boolean)" method similar to other setters, e.g. for various ssl related settings.

        Show
        Thomas Neidhart added a comment - This should already be possible by doing the following: Email email = .... Session session = email.getSession(); session.setProperty("mail.smtp.sendpartial", true); email.send(); Ideally, the Email class should provide a "setSendPartial(boolean)" method similar to other setters, e.g. for various ssl related settings.
        Hide
        Xudong Zheng added a comment -

        I think commons email should provide a way set up these kind of property. Could you provide a way to set java mail property?

        Show
        Xudong Zheng added a comment - I think commons email should provide a way set up these kind of property. Could you provide a way to set java mail property?
        Hide
        Thomas Neidhart added a comment -

        Thanks for the report, we will add a section to the javadoc of Email.send and the userguide.

        Show
        Thomas Neidhart added a comment - Thanks for the report, we will add a section to the javadoc of Email.send and the userguide.
        Hide
        Xudong Zheng added a comment -

        Hi, I found a way to fix this bug, it is set property "mail.smtp.sendpartial" & "mail.smtps.sendpartial" to true.
        e.g: for (String property : Arrays.asList("mail.smtp.sendpartial", "mail.smtps.sendpartial"))
        {
        if (System.getProperty(property) == null)

        { System.setProperty(property, "true"); }

        }

        LINK:https://issues.jenkins-ci.org/browse/JENKINS-9006

        Show
        Xudong Zheng added a comment - Hi, I found a way to fix this bug, it is set property "mail.smtp.sendpartial" & "mail.smtps.sendpartial" to true. e.g: for (String property : Arrays.asList("mail.smtp.sendpartial", "mail.smtps.sendpartial")) { if (System.getProperty(property) == null) { System.setProperty(property, "true"); } } LINK: https://issues.jenkins-ci.org/browse/JENKINS-9006

          People

          • Assignee:
            Unassigned
            Reporter:
            Xudong Zheng
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development