Affects Version/s: 7.0.X, 7.1.X, 7.2.X, Master
When a Site has a public page, the Virtual host of a Private Page isn't sent through a subscriber email. It's easier to understand the issue once you go through the steps to reproduce.
Steps to Reproduce
Setup: Setup an SMTP server so you can see emails. I suggest using http://nilhcem.com/FakeSMTP/ as it is a standalone .jar file that listens for SMTP.
Make sure the SMTP port FakeSMTP is using matches the one Liferay is using at Control Panel -> Server Administration -> Mail -> Outgoing SMTP Server
1. Create two sites
1.1. Site 1 (Only private pages)
1.1.1. Set Site URL -> Private Pages to: vh-site1
1.1.2. Add a new private page: Private 1
126.96.36.199. Add the blogs portlet to this page
1.2. Site 2 (Public and private pages)
1.2.1. Set Site URL -> Private Pages to: vh-site2
1.2.2. Add a new private page: Private 1
188.8.131.52. Add the blogs portlet to this page
1.2.3. Add a new public page: Public 1
2. Configure System Settings
2.1. On Comments setting update "Email Discussion Comment Added Body" to the following:
3. Create a new user: [email protected]
4. Create a new entry on Site 1/Private 1/Blogs portlet
5. Log in as [email protected] and subscribe to the entry you created on step 4
6. Log in as test/test (default Admin), and add a comment to the entry you created on step 4
7. [email protected] will receive a email with the following link. This is correct and the expected behavior
<a href="http://vh-site1:8080" target="_other" rel="nofollow">Liferay DXP</a>
8. Repeat the steps 4, 5, and 6 using Site 2
9. [email protected] will receive a email with the link:
9.1. Actual link received
<a href="http://localhost:8080" target="_other" rel="nofollow">Liferay DXP</a>
<a href="http://vh-site2:8080" target="_other" rel="nofollow">Liferay DXP</a>
If you delete the Public page in Site 2, the issue no longer reproduces and the link that is sent is the Expected link.
Reproduced in 72x-20200506
Reproduced in master-20200506. Note that in Master, Require strangers to verify their email address? is enabled by default, so you will need a verification code sent through email to login as [email protected] This shouldn't be an issue if you setup an SMTP server beforehand.