Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

added mail header when send email. added excludes to skip safety path check. added max database connection count.

Jackdcfff6a41405
diff --git a/core/internal/cmd/cmd.go b/core/internal/cmd/cmd.go
index c25a8f66..d1a18803 100644
--- a/core/internal/cmd/cmd.go
+++ b/core/internal/cmd/cmd.go
@@ -83,6 +83,13 @@ var (
// Use Redis for session storage
// s.SetSessionStorage(gsession.NewStorageRedis(g.Redis()))
+ // Define excluded URIs
+ excludesURIs := map[string]struct{}{
+ "/favicon.ico": {},
+ "/robots.txt": {},
+ "/unsubscribe.html": {},
+ }
+
// Bind Server Hooks
s.BindHookHandlerByMap("/*", map[ghttp.HookName]ghttp.HandlerFunc{
ghttp.HookBeforeServe: func(r *ghttp.Request) {
@@ -101,6 +108,11 @@ var (
return
}
+ // check if the request is in the excluded URIs
+ if _, ok := excludesURIs[r.URL.Path]; ok {
+ return
+ }
+
if !r.IsFileRequest() && !strings.HasPrefix(r.URL.Path, "/api/") {
return
}
diff --git a/core/internal/service/database_initialization/database_initialization.go b/core/internal/service/database_initialization/database_initialization.go
index f47bb530..1555b124 100644
--- a/core/internal/service/database_initialization/database_initialization.go
+++ b/core/internal/service/database_initialization/database_initialization.go
@@ -22,12 +22,13 @@ func InitDatabase() (err error) {
"default": gdb.ConfigGroup{
gdb.ConfigNode{
// Debug: true,
- Host: public.AbsPath(consts.POSTGRESQL_SOCK),
- User: "billionmail",
- Pass: dbPass,
- Name: "billionmail",
- Type: "pgsql",
- Role: "master",
+ Host: public.AbsPath(consts.POSTGRESQL_SOCK),
+ User: "billionmail",
+ Pass: dbPass,
+ Name: "billionmail",
+ Type: "pgsql",
+ Role: "master",
+ MaxOpenConnCount: 100,
},
},
})
diff --git a/core/internal/service/mail_service/sending.go b/core/internal/service/mail_service/sending.go
index 10bb574a..8fa4695f 100644
--- a/core/internal/service/mail_service/sending.go
+++ b/core/internal/service/mail_service/sending.go
@@ -362,7 +362,9 @@ func (e *EmailSender) doSend(message Message, recipients []string) error {
headerString := fmt.Sprintf("From: %s\r\n", from) +
fmt.Sprintf("To: %s\r\n", strings.Join(recipients, ",")) +
fmt.Sprintf("Subject: %s\r\n", message.MailTitle()) +
+ "MIME-Version: 1.0\r\n" +
"Content-Transfer-Encoding: quoted-printable\r\n" +
+ "X-Mailer: BillionMail\r\n" +
message.MailHeader() +
"\r\n" +
message.MailText() +