A VitoDeploy 4.x plugin that sends an email whenever a user successfully logs in. It uses VitoDeploy's existing Laravel mail configuration, so no additional mail package or duplicate SMTP credentials are required.
- VitoDeploy 4.x
- PHP 8.4
- A working mailer configured in the VitoDeploy
.envfile
Install the plugin from the VitoDeploy dashboard:
- Open Admin → Plugins.
- Install the GitHub repository for this plugin, or place it at
app/Vito/Plugins/Cp6/VitodeployLoginAlertfor local development. - Enable Login Alert.
The plugin validates that an alert recipient is available when it is installed or enabled.
The plugin sends through VitoDeploy's standard MAIL_* configuration. For example:
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=vito@example.com
MAIL_FROM_NAME="VitoDeploy"Login alerts are delivered to MAIL_FROM_ADDRESS, using VitoDeploy's configured default mailer and sender name.
After changing .env, clear VitoDeploy's cached configuration:
php artisan optimize:clear- An email is sent only after Laravel reports a successful authentication.
- Two-factor logins are reported after the second factor has succeeded, not when the password alone is accepted.
- Alerts include the user's name and email address, the request IP address, login time, and browser user agent.
- Failed password attempts do not generate alerts.
- Mail delivery is synchronous, so it does not require a queue worker.
- A mail transport failure is logged and does not prevent the user from logging in.
- Disabling the plugin prevents the event listener from being registered on the next application request.
If a login succeeds but no alert arrives, inspect VitoDeploy's
storage/logs/laravel.log for Unable to send the successful login alert email.
The entry includes the configured mailer and recipient together with the exception
class and message returned by the mail transport.
The feature suite is designed to run from a VitoDeploy 4.x checkout after this repository has been placed at app/Vito/Plugins/Cp6/VitodeployLoginAlert:
php artisan test app/Vito/Plugins/Cp6/VitodeployLoginAlert/tests/Feature/VitoLoginAlertTest.phpMIT