Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Email triggering to test user when Calendar Event is created
Hello everyone, I need a solution to my problem i.e., When i am adding an calendar event, an email is getting triggered to test@liferay.com in Liferay 7.2 . So i dont need the email triggered to test@liferay.com . So, can anyone help me to solve this problem.
Shiva Lingam K:
Keywords to look up in the documentation are
Hello everyone, I need a solution to my problem i.e., When i am adding an calendar event, an email is getting triggered to test@liferay.com in Liferay 7.2 . So i dont need the email triggered to test@liferay.com . So, can anyone help me to solve this problem.
- ServiceWrapper
- MessageQueue (for asynchronous handling)
I would suggest to go for a ServiceWrapper. In a project for Liferay 7.0 I used the following code (should be adapted easily for Liferay 7.2).
@Component(
immediate = true,
service = ServiceWrapper.class
)
public class CalendarBookingLocalServiceOverride extends CalendarBookingLocalServiceWrapper {
public CalendarBookingLocalServiceOverride() {
super(null);
}
@Override
public CalendarBooking addCalendarBooking(
long userId, long calendarId, long[] childCalendarIds,
long parentCalendarBookingId, Map<locale, string> titleMap,
Map<locale, string> descriptionMap, String location, long startTime,
long endTime, boolean allDay, String recurrence, long firstReminder,
String firstReminderType, long secondReminder,
String secondReminderType, ServiceContext serviceContext) throws PortalException {</locale,></locale,>
serviceContext.setAttribute("sendNotification", false);
return super.addCalendarBooking(userId, calendarId, childCalendarIds, parentCalendarBookingId, titleMap, descriptionMap, location, startTime, endTime, allDay, recurrence, firstReminder, firstReminderType, secondReminder, secondReminderType, serviceContext);
}
}
<p>HI Dominik Marks,</p>
<p> Thanks for your answer, but if we make this as false (<strong>serviceContext.setAttribute("sendNotification", false</strong>); ) it will disable the notifications to all users who are invited. But my requirement is not to allow email only to <strong>test@liferay .com</strong>. Can anyone suggest how it will be done ?</p>
<p> Thanks for your answer, but if we make this as false (<strong>serviceContext.setAttribute("sendNotification", false</strong>); ) it will disable the notifications to all users who are invited. But my requirement is not to allow email only to <strong>test@liferay .com</strong>. Can anyone suggest how it will be done ?</p>
You could just delete that user account. You shouldn't have it anyway - create your own administrator user, not one that any brute force attack would try to check for first. It's shocking how many installations use this ancient default - and probably quite some with a nonsecure password.
Figure out, why it's sent to that user - e.g. because it's the owner of the site where the calendar is positioned - that mail you might want to send (to a proper person).
I'm not sure, but also: Isn't test@liferay.com blacklisted, so you won't send out the email anyway? Or was this implemented later and comes in 7.3?
But in general: Don't create user accounts with mails that you don't control.
Figure out, why it's sent to that user - e.g. because it's the owner of the site where the calendar is positioned - that mail you might want to send (to a proper person).
I'm not sure, but also: Isn't test@liferay.com blacklisted, so you won't send out the email anyway? Or was this implemented later and comes in 7.3?
But in general: Don't create user accounts with mails that you don't control.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™