1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.mail.javamail;
  17. import java.io.IOException;
  18. import javax.mail.MessagingException;
  19. import javax.mail.internet.MimeMessage;
  20. /**
  21. * Callback interface for preparation of JavaMail MIME messages.
  22. *
  23. * <p>The corresponding send methods of JavaMailSender will take care
  24. * of the actual creation of a MimeMessage instance, and of proper
  25. * exception conversion.
  26. *
  27. * <p>It is often convenient to use a MimeMessageHelper for populating
  28. * the passed-in MimeMessage, particularly when working with attachments
  29. * or special character sets.
  30. *
  31. * @author Juergen Hoeller
  32. * @since 07.10.2003
  33. * @version $Id: MimeMessagePreparator.java,v 1.4 2004/03/18 02:46:14 trisberg Exp $
  34. * @see JavaMailSender#send(MimeMessagePreparator)
  35. * @see JavaMailSender#send(MimeMessagePreparator[])
  36. * @see MimeMessageHelper
  37. */
  38. public interface MimeMessagePreparator {
  39. /**
  40. * Prepare the given new MimeMessage instance.
  41. * @param mimeMessage the message to prepare
  42. * @throws MessagingException passing any exceptions thrown by MimeMessage
  43. * methods through for automatic conversion to the MailException hierarchy
  44. * @throws IOException passing any exceptions thrown by MimeMessage methods
  45. * through for automatic conversion to the MailException hierarchy
  46. */
  47. void prepare(MimeMessage mimeMessage) throws MessagingException, IOException;
  48. }