Hello @Nam.Ha
What ivy version are you using? First, I would test the mail server settings using the "Send Mail" button in Engine Cockpit.

When the license is getting expired, how long before it expires the email will be automatically sent to this configured email?
There is a job that checks for license expiration, which runs daily. It checks whether the license has already expired or will expire within a month. Therefore, Ivy administrators should receive a daily mail regarding license expiry starting one month before the expiration date.
How can I test this config to make sure it works at the time the license is going to expire?
Unfortunately, you can't test that.