Question Email notification when user logs in to Plesk

camthor

New Pleskian
Server operating system version
Debian 10.13
Plesk version and microupdate number
18.0.61_build1800240703.08
I want to set up notifications for any user login (including admin/root) to Plesk using this information: Question - Plesk email alert login

So I created an event "Plesk user logged in" with the command
Bash:
echo "username: ${NEW_CONTACT_NAME}" | mail -s "Plesk: User login" -r "[email protected]" [email protected]
. Priority lowest, user "root".

It works when I run this command with SSH, but no email arrives when I log out and log back in to Plesk. Do I have to enable events somewhere?
 
Hi there, did you use that command directly in the in the command field of the event? If so, I recommend creating a Bash script instead with that command and calling that script from the command field of the event instead.

There is a similar topic here that might help you troubleshoot.
 
Thank you! Indeed, it works now after I moved that line into a bash script and call that script in the event.
 
Hi, Is there any way to also put the IP address of the login to the mail body like:
Code:
echo "username: ${NEW_CONTACT_NAME}" | mail -s "User Login Plesk Panel" -b "$plesk db "SELECT login,ip_address FROM sessions;"" [email protected]
 
Back
Top