This guide will help you set up Gmail SMTP to send notifications to your blog subscribers using phcoder.blog@gmail.com.
- Go to your Google Account: https://myaccount.google.com/
- Navigate to Security β 2-Step Verification
- Enable 2-Step Verification if not already enabled
- Go to: https://myaccount.google.com/apppasswords
- Select Mail as the app
- Select Other (Custom name) as the device
- Enter a name like "PHcoder Blog SMTP"
- Click Generate
- Copy the 16-character app password (you won't see it again!)
Create a .env file in your project root:
# Gmail SMTP Configuration
REACT_APP_GMAIL_USER=phcoder.blog@gmail.com
REACT_APP_GMAIL_APP_PASSWORD=your-16-character-app-password-hereYour blog will now automatically send notifications when you create new blog posts. The system will:
β
Send beautiful HTML emails to all subscribers
β
Include blog title, excerpt, and direct link
β
Track notification history in Firebase
β
Handle errors gracefully with fallback options
Your notification emails will include:
- Subject: "π New Blog Post: [Blog Title]"
- From: phcoder.blog@gmail.com
- Content:
- Blog title and excerpt
- Reading time and category
- Direct link to the blog post
- Unsubscribe option
- Professional styling
- Create a new blog post in your admin dashboard
- Check the browser console for email sending logs
- Verify emails are received by test subscribers
- Check App Password: Make sure you copied the 16-character password correctly
- Verify 2FA: Ensure 2-factor authentication is enabled
- Check Environment Variables: Restart your development server after adding
.env - Console Logs: Check browser console for error messages
- "Invalid credentials": Double-check your app password
- "Less secure app": Use app password instead of regular password
- "Quota exceeded": Gmail has daily sending limits
Your newsletter admin dashboard shows:
- β Total subscribers
- β Notification history
- β Email delivery status
- β Unsubscribe management
- β App passwords are more secure than regular passwords
- β Each app password is unique and can be revoked
- β No need to store your main Gmail password
- β Environment variables keep credentials secure
- Test with a few subscribers first
- Monitor email delivery in your Gmail sent folder
- Check spam folders of recipients
- Consider SendGrid for production (higher limits)
Your notification system is now ready to send professional emails to your blog subscribers! π