Class MailTransportUtils

java.lang.Object
org.springframework.ws.transport.mail.support.MailTransportUtils

public abstract class MailTransportUtils extends Object
Collection of utility methods to work with Mail transports.
Since:
1.5.0
Author:
Arjen Poutsma
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    closeFolder(jakarta.mail.Folder folder)
    Close the given JavaMail Folder and ignore any thrown exception.
    static void
    closeFolder(jakarta.mail.Folder folder, boolean expunge)
    Close the given JavaMail Folder and ignore any thrown exception.
    static void
    closeService(jakarta.mail.Service service)
    Close the given JavaMail Service and ignore any thrown exception.
    static String
     
    static jakarta.mail.internet.InternetAddress
    getTo(URI uri)
     
    static String
    toPasswordProtectedString(jakarta.mail.URLName name)
    Returns a string representation of the given URLName, where the password has been protected.
    static URI
    toUri(jakarta.mail.internet.InternetAddress to, String subject)
    Converts the given internet address into a mailto URI.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTo

      public static jakarta.mail.internet.InternetAddress getTo(URI uri)
    • getSubject

      public static String getSubject(URI uri)
    • closeService

      public static void closeService(jakarta.mail.Service service)
      Close the given JavaMail Service and ignore any thrown exception. This is useful for typical finally blocks in manual JavaMail code.
      Parameters:
      service - the JavaMail Service to close (may be null)
      See Also:
      • Transport
      • Store
    • closeFolder

      public static void closeFolder(jakarta.mail.Folder folder)
      Close the given JavaMail Folder and ignore any thrown exception. This is useful for typical finally blocks in manual JavaMail code.
      Parameters:
      folder - the JavaMail Folder to close (may be null)
    • closeFolder

      public static void closeFolder(jakarta.mail.Folder folder, boolean expunge)
      Close the given JavaMail Folder and ignore any thrown exception. This is useful for typical finally blocks in manual JavaMail code.
      Parameters:
      folder - the JavaMail Folder to close (may be null)
      expunge - whether all deleted messages should be expunged from the folder
    • toPasswordProtectedString

      public static String toPasswordProtectedString(jakarta.mail.URLName name)
      Returns a string representation of the given URLName, where the password has been protected.
    • toUri

      public static URI toUri(jakarta.mail.internet.InternetAddress to, String subject) throws URISyntaxException
      Converts the given internet address into a mailto URI.
      Parameters:
      to - the To: address
      subject - the subject, may be null
      Returns:
      a mailto URI
      Throws:
      URISyntaxException