-
-
Save 000benniu/89a7e5be1a8ca9a7530423e4a9c1b3b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.portal.kernel.exception.PortalException | |
import com.liferay.portal.kernel.model.User | |
import com.liferay.portal.kernel.service.UserLocalServiceUtil | |
try { | |
// You can replace 'userId' with the actual user's ID | |
def user = UserLocalServiceUtil.getUser(44386) | |
def companyId = user.getCompanyId() | |
println "Company ID for User ${user.getScreenName()}: $companyId" | |
} catch (PortalException e) { | |
e.printStackTrace() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.mail.internet.InternetAddress; | |
import com.liferay.mail.kernel.model.MailMessage; | |
import com.liferay.mail.kernel.service.MailServiceUtil; | |
// from | |
InternetAddress from = new InternetAddress(); | |
from.setAddress("[email protected]"); | |
// to | |
InternetAddress to = new InternetAddress(); | |
to.setAddress("[email protected]"); | |
MailMessage mailMessage = new MailMessage(from,to,"bujsub","body body",Boolean.TRUE); | |
MailServiceUtil.sendEmail(mailMessage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment