Skip to content

Latest commit

Β 

History

History
95 lines (67 loc) Β· 2.98 KB

File metadata and controls

95 lines (67 loc) Β· 2.98 KB

Gmail SMTP Setup Guide for PHcoder Blog

This guide will help you set up Gmail SMTP to send notifications to your blog subscribers using phcoder.blog@gmail.com.

πŸ”§ Step 1: Enable 2-Factor Authentication

  1. Go to your Google Account: https://myaccount.google.com/
  2. Navigate to Security β†’ 2-Step Verification
  3. Enable 2-Step Verification if not already enabled

πŸ”‘ Step 2: Generate App Password

  1. Go to: https://myaccount.google.com/apppasswords
  2. Select Mail as the app
  3. Select Other (Custom name) as the device
  4. Enter a name like "PHcoder Blog SMTP"
  5. Click Generate
  6. Copy the 16-character app password (you won't see it again!)

πŸ“ Step 3: Create Environment File

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-here

πŸš€ Step 4: Test the Configuration

Your 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

πŸ“§ Email Templates

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

πŸ” Testing the Setup

  1. Create a new blog post in your admin dashboard
  2. Check the browser console for email sending logs
  3. Verify emails are received by test subscribers

πŸ› οΈ Troubleshooting

If emails aren't sending:

  1. Check App Password: Make sure you copied the 16-character password correctly
  2. Verify 2FA: Ensure 2-factor authentication is enabled
  3. Check Environment Variables: Restart your development server after adding .env
  4. Console Logs: Check browser console for error messages

Common Issues:

  • "Invalid credentials": Double-check your app password
  • "Less secure app": Use app password instead of regular password
  • "Quota exceeded": Gmail has daily sending limits

πŸ“Š Monitoring

Your newsletter admin dashboard shows:

  • βœ… Total subscribers
  • βœ… Notification history
  • βœ… Email delivery status
  • βœ… Unsubscribe management

πŸ”’ Security Notes

  • βœ… 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

🎯 Next Steps

  1. Test with a few subscribers first
  2. Monitor email delivery in your Gmail sent folder
  3. Check spam folders of recipients
  4. Consider SendGrid for production (higher limits)

Your notification system is now ready to send professional emails to your blog subscribers! πŸŽ‰