testng commited on
Commit
d0d4ece
Β·
verified Β·
1 Parent(s): afb65c5

Create an automated script to install and configure hMailServer on Windows.

Browse files

The script should:
1. Download the latest version of hMailServer from the official website.
2. Install it silently with default settings.
3. Create a new domain example.com.
4. Add a user test@example.com with password "Test1234".
5. Configure SMTP to allow sending emails on port 587 with SSL/TLS.
6. Enable logging for SMTP activity.
7. Make sure the script runs without manual intervention.
Provide the script in PowerShell with clear comments for each step.

Files changed (7) hide show
  1. README.md +8 -5
  2. components/footer.js +66 -0
  3. components/navbar.js +63 -0
  4. index.html +97 -19
  5. install-hmailserver.ps1 +118 -0
  6. script.js +24 -0
  7. style.css +24 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Hmail Wizard Installio
3
- emoji: πŸƒ
4
- colorFrom: pink
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: HMail Wizard Installio πŸ§™β€β™‚οΈ
3
+ colorFrom: green
4
+ colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background-color: #1a1a1a;
8
+ padding: 2rem;
9
+ margin-top: 3rem;
10
+ border-top: 1px solid #2d3748;
11
+ }
12
+ .footer-content {
13
+ max-width: 1200px;
14
+ margin: 0 auto;
15
+ display: grid;
16
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
17
+ gap: 2rem;
18
+ }
19
+ .footer-section h3 {
20
+ color: #8b5cf6;
21
+ margin-bottom: 1rem;
22
+ font-size: 1.1rem;
23
+ }
24
+ .footer-section p, .footer-section a {
25
+ color: #a0aec0;
26
+ margin-bottom: 0.5rem;
27
+ display: block;
28
+ text-decoration: none;
29
+ }
30
+ .footer-section a:hover {
31
+ color: #8b5cf6;
32
+ }
33
+ .copyright {
34
+ text-align: center;
35
+ margin-top: 2rem;
36
+ padding-top: 1rem;
37
+ border-top: 1px solid #2d3748;
38
+ color: #718096;
39
+ font-size: 0.875rem;
40
+ }
41
+ </style>
42
+ <footer>
43
+ <div class="footer-content">
44
+ <div class="footer-section">
45
+ <h3>ShadowSnap</h3>
46
+ <p>Stealthy automated backups for your important files.</p>
47
+ </div>
48
+ <div class="footer-section">
49
+ <h3>Quick Links</h3>
50
+ <a href="/">Home</a>
51
+ <a href="/settings">Settings</a>
52
+ <a href="/about">About</a>
53
+ </div>
54
+ <div class="footer-section">
55
+ <h3>Contact</h3>
56
+ <a href="mailto:support@shadowsnap.com">support@shadowsnap.com</a>
57
+ </div>
58
+ </div>
59
+ <div class="copyright">
60
+ &copy; ${new Date().getFullYear()} ShadowSnap. All rights reserved.
61
+ </div>
62
+ </footer>
63
+ `;
64
+ }
65
+ }
66
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background-color: #1a1a1a;
8
+ padding: 1rem 2rem;
9
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
10
+ }
11
+ .nav-container {
12
+ display: flex;
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ max-width: 1200px;
16
+ margin: 0 auto;
17
+ }
18
+ .logo {
19
+ display: flex;
20
+ align-items: center;
21
+ font-weight: 600;
22
+ font-size: 1.25rem;
23
+ color: #e2e8f0;
24
+ text-decoration: none;
25
+ }
26
+ .logo-icon {
27
+ margin-right: 0.5rem;
28
+ color: #8b5cf6;
29
+ }
30
+ .nav-links {
31
+ display: flex;
32
+ gap: 1.5rem;
33
+ }
34
+ .nav-link {
35
+ color: #cbd5e0;
36
+ text-decoration: none;
37
+ transition: color 0.2s;
38
+ font-weight: 500;
39
+ }
40
+ .nav-link:hover {
41
+ color: #8b5cf6;
42
+ }
43
+ .active {
44
+ color: #8b5cf6;
45
+ }
46
+ </style>
47
+ <nav>
48
+ <div class="nav-container">
49
+ <a href="/" class="logo">
50
+ <i data-feather="shield" class="logo-icon"></i>
51
+ ShadowSnap
52
+ </a>
53
+ <div class="nav-links">
54
+ <a href="/" class="nav-link active">Home</a>
55
+ <a href="/settings" class="nav-link">Settings</a>
56
+ <a href="/about" class="nav-link">About</a>
57
+ </div>
58
+ </div>
59
+ </nav>
60
+ `;
61
+ }
62
+ }
63
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,97 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ShadowSnap | Stealth Backup</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/navbar.js"></script>
12
+ <script src="components/footer.js"></script>
13
+ </head>
14
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
15
+ <custom-navbar></custom-navbar>
16
+
17
+ <main class="container mx-auto px-4 py-12">
18
+ <div class="max-w-4xl mx-auto bg-gray-800 rounded-xl shadow-2xl overflow-hidden">
19
+ <div class="p-8">
20
+ <div class="flex items-center mb-8">
21
+ <i data-feather="shield" class="w-12 h-12 text-purple-500 mr-4"></i>
22
+ <h1 class="text-3xl font-bold">ShadowSnap Backup</h1>
23
+ </div>
24
+
25
+ <div class="grid md:grid-cols-2 gap-8">
26
+ <div class="bg-gray-700 p-6 rounded-lg">
27
+ <h2 class="text-xl font-semibold mb-4 flex items-center">
28
+ <i data-feather="folder" class="mr-2"></i> Folder Monitoring
29
+ </h2>
30
+ <p class="text-gray-300 mb-4">Select folders to monitor for new files:</p>
31
+ <div class="space-y-4">
32
+ <div class="flex items-center">
33
+ <input type="checkbox" id="pictures" class="rounded text-purple-500">
34
+ <label for="pictures" class="ml-2">Pictures</label>
35
+ </div>
36
+ <div class="flex items-center">
37
+ <input type="checkbox" id="videos" class="rounded text-purple-500">
38
+ <label for="videos" class="ml-2">Videos</label>
39
+ </div>
40
+ <div class="flex items-center">
41
+ <input type="checkbox" id="documents" class="rounded text-purple-500">
42
+ <label for="documents" class="ml-2">Documents</label>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="bg-gray-700 p-6 rounded-lg">
48
+ <h2 class="text-xl font-semibold mb-4 flex items-center">
49
+ <i data-feather="mail" class="mr-2"></i> Email Configuration
50
+ </h2>
51
+ <div class="space-y-4">
52
+ <div>
53
+ <label class="block text-gray-300 mb-1">Destination Email</label>
54
+ <input type="email" class="w-full bg-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
55
+ </div>
56
+ <div>
57
+ <label class="block text-gray-300 mb-1">SMTP Server</label>
58
+ <input type="text" class="w-full bg-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
59
+ </div>
60
+ <div>
61
+ <label class="block text-gray-300 mb-1">Port</label>
62
+ <input type="number" class="w-full bg-gray-600 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+
68
+ <div class="mt-8 bg-gray-700 p-6 rounded-lg">
69
+ <h2 class="text-xl font-semibold mb-4 flex items-center">
70
+ <i data-feather="settings" class="mr-2"></i> Backup Settings
71
+ </h2>
72
+ <div class="flex flex-wrap gap-6">
73
+ <div class="flex items-center">
74
+ <input type="checkbox" id="autobackup" class="rounded text-purple-500" checked>
75
+ <label for="autobackup" class="ml-2">Enable Automatic Backup</label>
76
+ </div>
77
+ <button class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-lg flex items-center">
78
+ <i data-feather="send" class="mr-2"></i> Send Test Email
79
+ </button>
80
+ <button class="bg-gray-600 hover:bg-gray-500 px-4 py-2 rounded-lg flex items-center">
81
+ <i data-feather="save" class="mr-2"></i> Save Settings
82
+ </button>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </main>
88
+
89
+ <custom-footer></custom-footer>
90
+
91
+ <script>
92
+ feather.replace();
93
+ </script>
94
+ <script src="script.js"></script>
95
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
96
+ </body>
97
+ </html>
install-hmailserver.ps1 ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```powershell
2
+ <#
3
+ .SYNOPSIS
4
+ Automated installation and configuration script for hMailServer
5
+ .DESCRIPTION
6
+ This PowerShell script automates the installation and initial configuration of hMailServer,
7
+ including creating a domain, user account, and configuring SMTP settings with SSL/TLS.
8
+ .NOTES
9
+ File Name : install-hmailserver.ps1
10
+ Prerequisite : PowerShell 5.1+, Windows 10/11 or Windows Server 2016+
11
+ #>
12
+
13
+ # 1. Download the latest version of hMailServer from official website
14
+ Write-Host "Downloading latest hMailServer installer..."
15
+ $downloadUrl = "https://www.hmailserver.com/download"
16
+ $tempPath = $env:TEMP
17
+ $installerPath = "$tempPath\hmailserver-latest.exe"
18
+
19
+ try {
20
+ # Get the latest download URL from the website (this may need adjustment if they change their structure)
21
+ $response = Invoke-WebRequest -Uri $downloadUrl -UseBasicParsing
22
+ $downloadLink = ($response.Links | Where-Object { $_.href -like "*hMailServer*" -and $_.href -match "\.exe$" } | Select-Object -First 1).href
23
+
24
+ if (-not $downloadLink) {
25
+ throw "Could not find download link on hMailServer website"
26
+ }
27
+
28
+ # Complete the URL if it's relative
29
+ if (-not $downloadLink.StartsWith("http")) {
30
+ $downloadLink = "https://www.hmailserver.com$downloadLink"
31
+ }
32
+
33
+ Invoke-WebRequest -Uri $downloadLink -OutFile $installerPath -UseBasicParsing
34
+ Write-Host "Download completed successfully."
35
+ }
36
+ catch {
37
+ Write-Host "Error downloading hMailServer: $_" -ForegroundColor Red
38
+ exit 1
39
+ }
40
+
41
+ # 2. Install hMailServer silently with default settings
42
+ Write-Host "Installing hMailServer..."
43
+ try {
44
+ $installArgs = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /LOG=`"$tempPath\hmailserver_install.log`""
45
+ Start-Process -FilePath $installerPath -ArgumentList $installArgs -Wait
46
+
47
+ # Wait for service to be installed and started
48
+ Start-Sleep -Seconds 10
49
+ Write-Host "Installation completed successfully."
50
+ }
51
+ catch {
52
+ Write-Host "Error installing hMailServer: $_" -ForegroundColor Red
53
+ exit 1
54
+ }
55
+
56
+ # 3-7. Configure hMailServer using COM automation
57
+ Write-Host "Configuring hMailServer..."
58
+ try {
59
+ # Load hMailServer COM objects
60
+ $hMailApp = New-Object -ComObject hMailServer.Application
61
+
62
+ # Authenticate with the hMailServer administrator password (blank by default after install)
63
+ $hMailApp.Authenticate("Administrator", "")
64
+
65
+ # 3. Create a new domain example.com
66
+ $domain = $hMailApp.Domains.Add()
67
+ $domain.Name = "example.com"
68
+ $domain.Active = $true
69
+ $domain.Save()
70
+ Write-Host "Created domain: example.com"
71
+
72
+ # 4. Add a user test@example.com with password "Test1234"
73
+ $account = $domain.Accounts.Add()
74
+ $account.Address = "test@example.com"
75
+ $account.Password = "Test1234"
76
+ $account.Active = $true
77
+ $account.MaxSize = 100 # 100MB mailbox size
78
+ $account.Save()
79
+ Write-Host "Created user: test@example.com"
80
+
81
+ # 5. Configure SMTP to allow sending emails on port 587 with SSL/TLS
82
+ $tcpPort = $hMailApp.Settings.TCPIPPorts.Add()
83
+ $tcpPort.Address = "0.0.0.0" # Listen on all interfaces
84
+ $tcpPort.PortNumber = 587
85
+ $tcpPort.Protocol = 1 # SMTP
86
+ $tcpPort.ConnectionSecurity = 2 # SSL/TLS
87
+ $tcpPort.Save()
88
+
89
+ # Enable SMTP authentication
90
+ $hMailApp.Settings.SMTP.EnableAUTH = $true
91
+
92
+ # 6. Enable logging for SMTP activity
93
+ $hMailApp.Settings.Logging.Enabled = $true
94
+ $hMailApp.Settings.Logging.LogSMTP = $true
95
+
96
+ # Save all settings
97
+ $hMailApp.Settings.Save()
98
+ Write-Host "SMTP configured on port 587 with SSL/TLS and logging enabled."
99
+
100
+ # Restart hMailServer service to apply all changes
101
+ Restart-Service -Name "hMailServer" -Force
102
+ Write-Host "hMailServer service restarted to apply changes."
103
+ }
104
+ catch {
105
+ Write-Host "Error configuring hMailServer: $_" -ForegroundColor Red
106
+ exit 1
107
+ }
108
+
109
+ Write-Host "`nInstallation and configuration completed successfully!" -ForegroundColor Green
110
+ Write-Host "hMailServer is now running with:" -ForegroundColor Cyan
111
+ Write-Host "- Domain: example.com" -ForegroundColor Cyan
112
+ Write-Host "- User: test@example.com (password: Test1234)" -ForegroundColor Cyan
113
+ Write-Host "- SMTP on port 587 with SSL/TLS" -ForegroundColor Cyan
114
+ Write-Host "- SMTP logging enabled" -ForegroundColor Cyan
115
+ ```
116
+ ___METADATA_START___
117
+ {"isNew":true,"userName":"testng"}
118
+ ___METADATA_END___
script.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Initialize tooltips
3
+ const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
4
+ tooltipTriggerList.map(function (tooltipTriggerEl) {
5
+ return new bootstrap.Tooltip(tooltipTriggerEl);
6
+ });
7
+
8
+ // Form validation
9
+ const form = document.querySelector('form');
10
+ if (form) {
11
+ form.addEventListener('submit', function(e) {
12
+ e.preventDefault();
13
+ // Add form validation logic here
14
+ });
15
+ }
16
+
17
+ // Dark mode toggle
18
+ const darkModeToggle = document.getElementById('darkModeToggle');
19
+ if (darkModeToggle) {
20
+ darkModeToggle.addEventListener('click', function() {
21
+ document.documentElement.classList.toggle('dark');
22
+ });
23
+ }
24
+ });
style.css CHANGED
@@ -1,28 +1,34 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
28
  }
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ }
6
+
7
+ /* Custom scrollbar */
8
+ ::-webkit-scrollbar {
9
+ width: 8px;
10
  }
11
 
12
+ ::-webkit-scrollbar-track {
13
+ background: #1a1a1a;
 
14
  }
15
 
16
+ ::-webkit-scrollbar-thumb {
17
+ background: #6b46c1;
18
+ border-radius: 4px;
 
 
19
  }
20
 
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #805ad5;
 
 
 
 
23
  }
24
 
25
+ /* Animation for buttons */
26
+ button {
27
+ transition: all 0.2s ease-in-out;
28
  }
29
+
30
+ /* Custom focus styles */
31
+ input:focus, button:focus {
32
+ outline: none;
33
+ box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5);
34
+ }