How to Enable a Gmail App Password for SMTP

An App Password is a 16-character password that lets an app or server (e.g. PHPMailer, WordPress SMTP, Laravel, Outlook) send email through your Gmail account without using your main password.
Step 1: Turn On 2-Step Verification
App Passwords can only be created once 2-Step Verification is enabled.
- Go to https://myaccount.google.com and sign in.
- Open the Security tab.
- Under “How you sign in to Google”, click 2-Step Verification.
- Follow the prompts until it shows On.
Step 2: Create an App Password
- Go to https://myaccount.google.com/apppasswords (or search “App passwords” in your Google Account search bar).
- Re-enter your password if prompted.
- Type an app name, for example Website SMTP.
- Click Create.
- Copy the 16-character code shown (e.g. abcd efgh ijkl mnop). It is displayed only once.
Step 3: Use It in Your SMTP Settings
SettingValue
SMTP Host
smtp.gmail.com
Port
587 (TLS/STARTTLS) or 465 (SSL)
Username
your full Gmail address
Password
the 16-character App Password (no spaces)
Encryption
TLS or SSL
Important Notes :
If the App Passwords option doesn’t appear, 2-Step Verification may not be on, your account may use Advanced Protection, or (for Google Workspace accounts) your admin may have disabled the feature. All App Passwords are automatically revoked when you change your Google Account password, so you’ll need to create a new one. Never share your App Password, and delete unused ones from the same page.