Class MailTransportUtils
java.lang.Object
org.springframework.integration.mail.MailTransportUtils
Collection of utility methods to work with Mail transports.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeFolder
(@Nullable jakarta.mail.Folder folder, boolean expunge) Close the given JavaMail Folder and ignore any thrown exception.static void
closeService
(@Nullable jakarta.mail.Service service) Close the given JavaMail Service and ignore any thrown exception.static String
toPasswordProtectedString
(jakarta.mail.URLName name) Returns a string representation of the givenURLName
, where the password has been protected.
-
Constructor Details
-
MailTransportUtils
public MailTransportUtils()
-
-
Method Details
-
closeService
public static void closeService(@Nullable jakarta.mail.Service service) Close the given JavaMail Service and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JavaMail code.- Parameters:
service
- the JavaMail Service to close (may benull
)- See Also:
-
closeFolder
public static void closeFolder(@Nullable jakarta.mail.Folder folder, boolean expunge) Close the given JavaMail Folder and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JavaMail code.- Parameters:
folder
- the JavaMail Folder to close (may benull
)expunge
- whether all deleted messages should be expunged from the folder
-
toPasswordProtectedString
Returns a string representation of the givenURLName
, where the password has been protected.- Parameters:
name
- The URL name.- Returns:
- The result with password protection.
-