To be able to use a Gmail email address in your contact form, you need to make some changes in your Gmail account settings. This only applies if you want to send From the Gmail account. Skip this part if you use Gmail only in the To field.
Google may block sign-in attempts from IP's which are located far from the usual geographical location of the mailbox owner. In such case, the “Suspicious sign in is prevented” email will appear in the Gmail inbox.
Please follow the below steps to use a Gmail email address in your contact form:
1) Sign in your Gmail account (https://myaccount.google.com) and find the Password & sign-in method section. Turn 2-Step Verification off, if you are using it (mail script will not be able to log in to the account when it is turn on).
2) Scroll down to the Apps with account access section and turn ON Allow less secure apps
3) Next, go to https://accounts.google.com/DisplayUnlockCaptcha and click Continue.
Now you can configure and test your contact form. Use the following SMTP settings:
- Email sending method: SMTP;
- SMTP authentication: enabled;
- SMTP username: email@example.com;
- SMTP password: password for this email address;
- SMTP hostname: gmail.com;
- SMTP port: 465 with SSL turned on.