This guide explains how to configure proper email sender names and display information for your BlogSpot application.
Add these variables to your .env file:
# Gmail SMTP Configuration
GMAIL_USER=your-email@gmail.com
GMAIL_APP_PASSWORD=your-16-character-app-password
# Email Sender Configuration
SENDER_NAME=BlogSpot - Tech Blog & Programming Tutorials
SENDER_DISPLAY_NAME=BlogSpot Team
# Frontend Configuration (optional)
VITE_SENDER_NAME=BlogSpot - Tech Blog & Programming Tutorials
VITE_SENDER_DISPLAY_NAME=BlogSpot Team
VITE_GMAIL_USER=your-email@gmail.comFrom: "BlogSpot - Tech Blog & Programming Tutorials" <your-email@gmail.com>
Reply-To: your-email@gmail.com
- Header: Shows brand name and professional title
- Signature: Shows team name
- Footer: Shows full brand information
BlogSpot - Tech Blog & Programming Tutorials
TechInsights - Development & Programming News
CodeMaster - Learn Programming & Web Development
blogspot (too generic)
myemail@gmail.com (just email address)
Blog (too short)
- Updated default sender name to be more descriptive
- Uses
SENDER_NAMEenvironment variable
- Added
senderDisplayNameconfiguration - Created
getSenderInfo()utility function - Centralized sender information management
- EmailService: Uses centralized configuration
- RealEmailService: Now uses proper sender info
- SimpleSmtpService: Updated sender format
- NewsletterService: Already using proper methods
curl -X POST http://localhost:3000/api/email/test-smtp// Frontend test
import { EmailService } from './src/utils/emailService';
await EmailService.sendBlogNotification('test@example.com', {
blogs: { title: 'Test Post', content: 'Test content' },
id: 'test123'
});When you receive the test email, check the email headers to verify:
- From field shows your configured sender name
- Reply-To is set correctly
- No "via" or "on behalf of" warnings (if Gmail is configured properly)
Solution: Ensure SENDER_NAME is set in your .env file
Solution: This is normal for Gmail SMTP. To avoid this, use a custom domain email
Solutions:
- Set up SPF, DKIM, and DMARC records
- Use a professional sender name
- Avoid spam trigger words in subject lines
For professional emails without "via Gmail":
- Get a custom domain (e.g., yourdomain.com)
- Set up email hosting (Google Workspace, etc.)
- Configure DNS records (SPF, DKIM, DMARC)
- Update SMTP settings to use custom domain
For different types of emails:
// In emailConfig.js
export const senderConfigs = {
newsletter: {
name: 'BlogSpot Newsletter',
email: 'newsletter@yourdomain.com'
},
support: {
name: 'BlogSpot Support',
email: 'support@yourdomain.com'
},
noreply: {
name: 'BlogSpot (No Reply)',
email: 'noreply@yourdomain.com'
}
};| Variable | Purpose | Example |
|---|---|---|
SENDER_NAME |
Main sender name for emails | BlogSpot - Tech Blog |
SENDER_DISPLAY_NAME |
Display name in email content | BlogSpot Team |
GMAIL_USER |
Gmail account for SMTP | your-email@gmail.com |
GMAIL_APP_PASSWORD |
Gmail app password | abcd efgh ijkl mnop |
-
.envfile has proper sender configuration - Server restarts after environment changes
- Test email shows proper sender name
- Email doesn't go to spam folder
- Reply-To header is correct
- Email signature shows team information
If you encounter issues with email sender configuration:
- Check server logs for SMTP errors
- Verify Gmail app password is correct
- Test with a simple email client first
- Check DNS configuration if using custom domain
Note: Changes to environment variables require a server restart to take effect.