folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
/** * Copy the specified messages to another folder. * The default implementation simply appends the supplied messages to the * target folder using {@link #appendMessages(Message[])}. * @param messages the messages to copy * @param folder the folder to copy to * @throws MessagingException if there was a problem accessing the store */ public void copyMessages(Message[] messages, Folder folder) throws MessagingException { folder.appendMessages(messages); }
/** * Copy the specified messages to another folder. * The default implementation simply appends the supplied messages to the * target folder using {@link #appendMessages(Message[])}. * @param messages the messages to copy * @param folder the folder to copy to * @throws MessagingException if there was a problem accessing the store */ public void copyMessages(Message[] messages, Folder folder) throws MessagingException { folder.appendMessages(messages); }
Transport.send(msg); Folder sent = store.getFolder("Sent"); sent.appendMessages(new Message[] { msg });
@Override public void appendMessages(Message[] msgs) throws RuntimeMessagingException { try { delegate.appendMessages(msgs); } catch (MessagingException e) { throw new RuntimeMessagingException(e); } }
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
folder); folder.appendMessages(msgs);
@Override public synchronized void copyMessages(final Message[] msgs, final Folder folder) throws MessagingException { abortIdle(); checkOpened(); checkExists(); if (msgs == null || folder == null || msgs.length == 0) { return; } if (!folder.exists()) { throw new FolderNotFoundException(folder.getFullName() + " does not exist", folder); } folder.appendMessages(msgs); }
@Override public synchronized void copyMessages(final Message[] msgs, final Folder folder) throws MessagingException { abortIdle(); checkOpened(); checkExists(); if (msgs == null || folder == null || msgs.length == 0) { return; } if (!folder.exists()) { throw new FolderNotFoundException(folder.getFullName() + " does not exist", folder); } folder.appendMessages(msgs); }
@Override public synchronized void copyMessages(final Message[] msgs, final Folder folder) throws MessagingException { abortIdle(); checkOpened(); checkExists(); if (msgs == null || folder == null || msgs.length == 0) { return; } if (!folder.exists()) { throw new FolderNotFoundException(folder.getFullName() + " does not exist", folder); } folder.appendMessages(msgs); }
... // send the org.apache.commons.mail.HtmlEmail email.send(); copyIntoSent(email.getMailSession(), email.getMimeMessage()); } private void copyIntoSent(final Session session, final Message msg) throws MessagingException { final Store store = session.getStore("imaps"); store.connect(IMAP_HOST, SMTP_AUTH_USER, SMTP_AUTH_PWD); final Folder folder = (Folder) store.getFolder("Sent Items"); if (folder.exists() == false) { folder.create(Folder.HOLDS_MESSAGES); } folder.open(Folder.READ_WRITE); folder.appendMessages(new Message[] { msg }); }