Example usage for com.liferay.portal.kernel.util PropsKeys MAIL_HOOK_SENDMAIL_ADD_USER

List of usage examples for com.liferay.portal.kernel.util PropsKeys MAIL_HOOK_SENDMAIL_ADD_USER

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys MAIL_HOOK_SENDMAIL_ADD_USER.

Prototype

String MAIL_HOOK_SENDMAIL_ADD_USER

To view the source code for com.liferay.portal.kernel.util PropsKeys MAIL_HOOK_SENDMAIL_ADD_USER.

Click Source Link

Usage

From source file:com.liferay.mail.util.SendmailHook.java

License:Open Source License

public void addUser(long companyId, long userId, String password, String firstName, String middleName,
        String lastName, String emailAddress) {

    // Get add user command

    String addUserCmd = PropsUtil.get(PropsKeys.MAIL_HOOK_SENDMAIL_ADD_USER);

    // Replace userId

    addUserCmd = StringUtil.replace(addUserCmd, "%1%", String.valueOf(userId));

    Runtime rt = Runtime.getRuntime();

    try {//  ww w  .  j av  a  2  s .co  m
        Process p = rt.exec(addUserCmd);

        ProcessUtil.close(p);
    } catch (Exception e) {
        _log.error(e, e);
    }

    updatePassword(companyId, userId, password);
    updateEmailAddress(companyId, userId, emailAddress);
}