How to reset mail settings

Issue

  • How can I reset (delete from the database) mail settings I have previously set and saved from the UI, at Control Panel > Configuration > Server Administration > Mail? (e.g if I want to provide them through portal properties or environment variables)

Environment

  • DXP 7.2

Resolution

  • These settings are stored in the portalpreferences database table. Use the 
public static com.liferay.portal.kernel.model.PortalPreferences
    deletePortalPreferences(long portalPreferencesId)

API method from the com.liferay.portal.kernel.service.PortalPreferencesLocalServiceUtil class, where you pass the portalPreferencesId of the correspondinf line in the portalpreferences DB table. Example Groovy script for invoking this API method:

import com.liferay.portal.kernel.service.PortalPreferencesLocalServiceUtil;

PortalPreferencesLocalServiceUtil.deletePortalPreferences(20131);

 

この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています