You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Brian Telintelo (Created) (JIRA)" <ji...@apache.org> on 2012/02/28 16:17:46 UTC

[jira] [Created] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Need a way to remove emails from an already created, but not sent message.
--------------------------------------------------------------------------

                 Key: EMAIL-115
                 URL: https://issues.apache.org/jira/browse/EMAIL-115
             Project: Commons Email
          Issue Type: Improvement
    Affects Versions: 1.2
            Reporter: Brian Telintelo
            Priority: Blocker
             Fix For: 2.0


Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no set message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Thomas Neidhart (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218277#comment-13218277 ] 

Thomas Neidhart commented on EMAIL-115:
---------------------------------------

just my2c, but wouldn't it be better to set up a fake mail server in your test environment and check if the mail was sent through it as a valid unit test?
Take a look at the unit tests for commons-email itself, which actually does exactly this.

ref: BaseEmailTestCase, SendWithAttachmentsTest
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Thomas Neidhart (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Neidhart resolved EMAIL-115.
-----------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 2.0)

User found a work-around, and adding remove methods is not desirable atm.
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Brian Telintelo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218475#comment-13218475 ] 

Brian Telintelo commented on EMAIL-115:
---------------------------------------

Thanks, that is a good work around. 
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Brian Telintelo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218292#comment-13218292 ] 

Brian Telintelo commented on EMAIL-115:
---------------------------------------

We do have unit tests for this, but the QA team will still want to verify that email is sent/received after certain steps in test execution.  I think your solution(fake mail server) may work, but it could be more manual effort.  Changed the recipient list is a one time change.    
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Brian Telintelo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Telintelo updated EMAIL-115:
----------------------------------

    Description: Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.  (was: Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no set message accessor available.  We need a way to remove emails....somehow.)
    
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Thomas Neidhart (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218429#comment-13218429 ] 

Thomas Neidhart edited comment on EMAIL-115 at 2/28/12 6:29 PM:
----------------------------------------------------------------

ah stupid me, missed the isEmpty(). But you could still set all three fields to the same email-address, the mail server should send it normally just once.

Note: this idea is just to support your use-case without changing the existing code.
                
      was (Author: tn):
    ah stupid me, missed the isEmpty(). But you could still set all three fields to the same email-address, the mail server should send it normally just once.
                  
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Brian Telintelo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218425#comment-13218425 ] 

Brian Telintelo commented on EMAIL-115:
---------------------------------------

Yes, that is exactly what I want to do.  However, in the set method, it throws an exception for an empty list:

    public Email setTo(Collection aCollection) throws EmailException
    {
        if (aCollection == null || aCollection.isEmpty())
        {
            throw new EmailException("Address List provided was invalid");
        }

        this.toList = new ArrayList(aCollection);
        return this;
    }

I think the isEmpty check should be removed, or a seperate clear method added to reset the collection.
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Thomas Neidhart (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218420#comment-13218420 ] 

Thomas Neidhart commented on EMAIL-115:
---------------------------------------

Looking up the javadoc, there is no way to remove addresses added to the to/cc/bcc fields, but you can override their values by calling the appropriate setXXX [To,Cc,Bcc] with a collection of InternetAddress instances. In your case you would call it like this (if I understand you correctly):

{noformat}
public void sendMail(final Email mail) {
  // clear cc and bcc
  mail.setCc(new LinkedList());
  mail.setBcc(new LinkedList());

  // set To to the testing list -> first clear out existing To entries
  mail.setTo(new LinkedList());
  mail.addTo("test@mydomain.org");
}
{noformat}

I mean, this does not look very nice, but would work for your situation I guess?
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (EMAIL-115) Need a way to remove emails from an already created, but not sent message.

Posted by "Thomas Neidhart (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218429#comment-13218429 ] 

Thomas Neidhart commented on EMAIL-115:
---------------------------------------

ah stupid me, missed the isEmpty(). But you could still set all three fields to the same email-address, the mail server should send it normally just once.
                
> Need a way to remove emails from an already created, but not sent message.
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-115
>                 URL: https://issues.apache.org/jira/browse/EMAIL-115
>             Project: Commons Email
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Brian Telintelo
>            Priority: Blocker
>             Fix For: 2.0
>
>
> Ok, so we have one send email method which takes org.apache.commons.mail.Email param.  It then checks to see if email sending is enabled(configured by server instance), then sends the mail if it is.  Problem happens for our QA testing.  We need to test email content, but don't want to send emails to actual users in QA environment.  What we want to do is modify our "one" send email method and clear out the To,CC,BCC fields and then set the TO field to be our testing list.  But, there is no way to remove emails already added.  Setting it to null or empty collection results in an EmailException.  And we can't create a new email instance and copy because there is no get message accessor available.  We need a way to remove emails....somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira