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 corresponding line in the portalpreferences DB table. Example Groovy script for invoking this API method:
import com.liferay.portal.kernel.service.PortalPreferencesLocalServiceUtil;
PortalPreferencesLocalServiceUtil.deletePortalPreferences(20131);