Hello everyone ,thanks for all answers ,i fixed the problem, i will write below what i did :
1 - Go to your gmail account and open settings - Forwarding POP/IMAP - click enable imap.
2 - click Manage your google account - Security - enable 2 step verification (turn on) -
3 - go to that site and write your domain and email:
https://improvmx.com/ ,confirm the email and minimize the window and don't close it
4 - DNS SETTINGS
- If u use cloudflare go directly to cloudflare in section DNS and delete all MX records -
5 - Go to that site:
https://improvmx.com/guides/configure-your-dns/
- go back to cloudflare and click add new record - copy/paste mx records and txt
- wait 5 minutes - go to your minimized window (
https://improvmx.com/ ) '' click CHECK ''
6 - go back to your gmail - click manage your google accounts - security - find section ''App passwords '' and click . it should request the password of your account ,write it .
- click select app - click Other custom name - write your domain - click generate - copy the generated password and remember it or save it in text document because you will need it.
7 - go back to your gmail - settings - accounts and import - add another email adress -
- Write whatever name
- For email adress write what email you want for your domain. example:
[email protected] and click next.
- In smtp server write: smtp.gmail.com
- For email write the same email from previous section -
[email protected] -
- for password - the generated app password which you remember and saved.
- remember the port number. example 587
- click add account
- confirm email - click confirm
8 - go to your infinityFree host and delete all mx records , add the new Mx records from
https://improvmx.com/guides/configure-your-dns/ (which you already used in previous step)
9 - go to your site in admin control panel - configuration - site details - write the new email adress for your domain
10 - in admin control panel - configuration - mail settings - click smtp
-hostname: smtp.gmail.com
-port: write your port number
-username = your gmail account (not your new email domain)
- password = your generated app password
- i use tls encryption for me
- click save
all done!
the above worked for me