-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSETUP_EMAIL.bat
More file actions
130 lines (116 loc) · 3.2 KB
/
SETUP_EMAIL.bat
File metadata and controls
130 lines (116 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@echo off
echo ========================================
echo Email Configuration Setup
echo ========================================
echo.
echo This script will help you create a .env file
echo with email configuration for the backend.
echo.
REM Check if .env already exists
if exist .env (
echo WARNING: .env file already exists!
echo.
set /p overwrite="Do you want to overwrite it? (y/n): "
if /i not "%overwrite%"=="y" (
echo.
echo Setup cancelled. Your existing .env file was not modified.
pause
exit /b
)
)
echo.
echo Let's set up your email configuration...
echo.
echo ========================================
echo SMTP Configuration
echo ========================================
echo.
echo Common SMTP providers:
echo 1. Gmail (smtp.gmail.com, port 587)
echo 2. Outlook (smtp-mail.outlook.com, port 587)
echo 3. SendGrid (smtp.sendgrid.net, port 587)
echo 4. Other
echo.
set /p smtp_host="Enter SMTP Host (default: smtp.gmail.com): "
if "%smtp_host%"=="" set smtp_host=smtp.gmail.com
set /p smtp_port="Enter SMTP Port (default: 587): "
if "%smtp_port%"=="" set smtp_port=587
set /p smtp_user="Enter SMTP User (your email): "
if "%smtp_user%"=="" (
echo ERROR: Email address is required!
pause
exit /b 1
)
set /p smtp_pass="Enter SMTP Password (App Password for Gmail): "
if "%smtp_pass%"=="" (
echo ERROR: Password is required!
pause
exit /b 1
)
set /p smtp_from="Enter From Name (default: CounselIndia): "
if "%smtp_from%"=="" set smtp_from=CounselIndia
echo.
echo ========================================
echo Creating .env file...
echo ========================================
echo.
(
echo # Server Configuration
echo NODE_ENV=development
echo PORT=5000
echo FRONTEND_URL=http://localhost:8080
echo.
echo # Database
echo MONGODB_URI=mongodb://localhost:27017/l2h-blog
echo.
echo # JWT
echo JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
echo.
echo # Email Configuration
echo SMTP_HOST=%smtp_host%
echo SMTP_PORT=%smtp_port%
echo SMTP_USER=%smtp_user%
echo SMTP_PASS=%smtp_pass%
echo SMTP_FROM="%smtp_from%" ^<%smtp_user%^>
echo.
echo # OTP Configuration
echo OTP_EXPIRY_MINUTES=10
echo.
echo # Rate Limiting
echo RATE_LIMIT_WINDOW_MS=900000
echo RATE_LIMIT_MAX_REQUESTS=100
echo.
echo # API URL
echo VITE_API_URL=http://localhost:5000
) > .env
echo ✓ .env file created successfully!
echo.
echo ========================================
echo Testing Email Configuration...
echo ========================================
echo.
set /p test_email="Enter email address to send test email (or press Enter to skip): "
if not "%test_email%"=="" (
echo.
echo Sending test email to %test_email%...
echo.
node test-email.js %test_email%
echo.
)
echo.
echo ========================================
echo Setup Complete!
echo ========================================
echo.
echo Next steps:
echo 1. Restart your backend server
echo 2. Test ebook downloads at http://localhost:8080/ebooks
echo.
echo For Gmail users:
echo - Make sure you're using an App Password
echo - Enable 2-Step Verification first
echo - Generate App Password at: https://myaccount.google.com/apppasswords
echo.
echo Need help? See EMAIL_SETUP_GUIDE.md
echo.
pause