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

Fixed BCC configuration issue. Cancelled pause the email sending when score too low by IP warmup.

Jackb3c01b07448f
diff --git a/core/internal/controller/mail_services/mail_services.go b/core/internal/controller/mail_services/mail_services.go
index 412a5558..40943e41 100644
--- a/core/internal/controller/mail_services/mail_services.go
+++ b/core/internal/controller/mail_services/mail_services.go
@@ -5,6 +5,7 @@
package mail_services
import (
+ "billionmail-core/internal/consts"
"billionmail-core/internal/model/entity"
docker "billionmail-core/internal/service/dockerapi"
"billionmail-core/internal/service/public"
@@ -41,10 +42,10 @@ func processForwardUsers(forwardUsers string) []string {
func SyncBccToPostfix(ctx context.Context) error {
// configPath
- postfixConfigDir := public.AbsPath("../conf/postfix/conf")
+ postfixConfigDir := public.AbsPath(consts.POSTFIX_CONF_PATH)
senderBccFile := path.Join(postfixConfigDir, "sender_bcc")
recipientBccFile := path.Join(postfixConfigDir, "recipient_bcc")
- mainCfFile := path.Join(postfixConfigDir, "main.cf")
+ mainCfFile := public.AbsPath(consts.POSTFIX_MAIN_CONF)
if !gfile.Exists(postfixConfigDir) {
return gerror.New(public.LangCtx(ctx, "Postfix configuration directory does not exist : {}", postfixConfigDir))
diff --git a/core/internal/service/warmup/sender_ip_mail_provider.go b/core/internal/service/warmup/sender_ip_mail_provider.go
index 3257fbf0..e91417aa 100644
--- a/core/internal/service/warmup/sender_ip_mail_provider.go
+++ b/core/internal/service/warmup/sender_ip_mail_provider.go
@@ -217,13 +217,13 @@ func (s *SenderIpMailProviderService) EvaluateScoreForProvider(ctx context.Conte
} else if totalSent < minSendVolumeForProviderScoring && totalSent > 0 {
switch {
case hardBounces > 0:
- currentScore -= 20 // Hard bounce penalty
+ currentScore -= 0.2 // Hard bounce penalty
case softBounces > 0:
- currentScore -= 10 // Soft bounce penalty
+ currentScore -= 0.1 // Soft bounce penalty
case successfulSends > 0:
- currentScore += 3 // Reward for successful sending
+ currentScore += 0.3 // Reward for successful sending
default:
- currentScore -= 8 // Penalty for no sending records
+ currentScore -= 0.8 // Penalty for no sending records
}
} else if totalSent >= minSendVolumeForProviderScoring {
successRate := float64(successfulSends) / float64(totalSent)
@@ -231,10 +231,10 @@ func (s *SenderIpMailProviderService) EvaluateScoreForProvider(ctx context.Conte
softBounceRate := float64(softBounces) / float64(totalSent)
deferredRate := float64(deferredSends) / float64(totalSent) // deferredSends comes from overall statistics and needs adjustment
- currentScore += (successRate - 0.85) * 40 // 85% success rate benchmark, affects 40 points
- currentScore -= hardBounceRate * 150 // Higher penalty coefficient for hard bounces
- currentScore -= softBounceRate * 70
- currentScore -= deferredRate * 25 // Latency also affects provider score
+ currentScore += math.Max(0, successRate-0.85) * 40 // 85% success rate benchmark, affects 40 points
+ currentScore -= hardBounceRate * 1.5 // Higher penalty coefficient for hard bounces
+ currentScore -= softBounceRate * 0.7
+ currentScore -= deferredRate * 0.25 // Latency also affects provider score
if successfulSends > 0 {
openRate := float64(openedCount) / float64(successfulSends)
@@ -287,15 +287,15 @@ func (s *SenderIpMailProviderService) GetSendingRateFactorForProvider(ctx contex
minScore := float64(minScoreForSendingProvider)
score := float64(providerStatus.Score)
- if score < minScore {
- g.Log().Debugf(ctx, "GetSendingRateFactorForProvider: IP %s, Group %s PAUSED (Score %d < %d)", senderIp, mailProviderGroup, providerStatus.Score, int(minScore))
- return 0.0, nil // Score is too low, pause sending to this provider group.
- }
+ //if score < minScore {
+ // g.Log().Debugf(ctx, "GetSendingRateFactorForProvider: IP %s, Group %s PAUSED (Score %d < %d)", senderIp, mailProviderGroup, providerStatus.Score, int(minScore))
+ // return 0.0, nil // Score is too low, pause sending to this provider group.
+ //}
// Linearly map the score from minScore-100 to a rate factor of 0.1-1.0.
// Even at the lowest allowed score, a 10% rate is maintained.
factor := 0.1 + (score-minScore)/(100.0-minScore)*0.9
- rateFactor = math.Max(0, math.Min(1, factor)) // Ensure the factor is between 0 and 1.
+ rateFactor = math.Max(0.05, math.Min(1, factor)) // Ensure the factor is between 0.05 and 1.
g.Log().Debugf(ctx, "GetSendingRateFactorForProvider: IP %s, Group %s (Prov Score %d) -> Rate Factor: %.3f", senderIp, mailProviderGroup, providerStatus.Score, rateFactor)
return rateFactor, nil
diff --git a/core/internal/service/warmup/sender_ip_warmup.go b/core/internal/service/warmup/sender_ip_warmup.go
index 0f7b138b..53e3daaf 100644
--- a/core/internal/service/warmup/sender_ip_warmup.go
+++ b/core/internal/service/warmup/sender_ip_warmup.go
@@ -211,13 +211,13 @@ func (s *SenderIpWarmupService) EvaluateIpScore(ctx context.Context, senderIp st
g.Log().Infof(ctx, "EvaluateIpScore: IP %s has no configured sender identities. Score remains %d.", senderIp, warmupStatus.Score)
} else if totalSent < minSendVolumeForFullScoring && totalSent > 0 { // Low sending volume
if hardBounces > 0 {
- currentScore -= 15 // Low volume but with hard bounces, heavy penalty
+ currentScore -= 1.5 // Low volume but with hard bounces, heavy penalty
} else if softBounces > 0 {
- currentScore -= 7 // Low volume with soft bounces
+ currentScore -= 0.7 // Low volume with soft bounces
} else if successfulSends > 0 {
- currentScore += 2 // Low volume but with successes
+ currentScore += 0.2 // Low volume but with successes
} else { // Low volume and no successes (could be all deferred or other issues)
- currentScore -= 5
+ currentScore -= 0.5
}
} else if totalSent >= minSendVolumeForFullScoring { // Sufficient sending volume for a more comprehensive scoring
successRate := float64(successfulSends) / float64(totalSent)
@@ -226,12 +226,12 @@ func (s *SenderIpWarmupService) EvaluateIpScore(ctx context.Context, senderIp st
deferredRate := float64(deferredSends) / float64(totalSent)
// Adjust based on success rate
- currentScore += (successRate - 0.8) * 30 // 80% success rate is the baseline, fluctuation affects 30 points
+ currentScore += math.Max(0, successRate-0.8) * 30 // 80% success rate is the baseline, fluctuation affects 30 points
// Adjust based on bounce rate
- currentScore -= hardBounceRate * 100 // Penalty coefficient for hard bounces is 100
- currentScore -= softBounceRate * 50 // Penalty coefficient for soft bounces is 50
- currentScore -= deferredRate * 20 // Penalty coefficient for deferred is 20
+ currentScore -= hardBounceRate * 10 // Penalty coefficient for hard bounces is 10
+ currentScore -= softBounceRate * 5 // Penalty coefficient for soft bounces is 5
+ currentScore -= deferredRate * 2 // Penalty coefficient for deferred is 2
// Adjust based on open and click rates (requires openedCount, clickedCount data)
if successfulSends > 0 {
@@ -245,7 +245,7 @@ func (s *SenderIpWarmupService) EvaluateIpScore(ctx context.Context, senderIp st
} else { // totalSent == 0 (but there are relevant pmids or identities, indicating no sending within the window)
if warmupStatus.Progress > 65 { // High progress but no sending
if warmupStatus.Score < 50 {
- currentScore -= 1 // If the score is already not high and there is continuous no sending, decrease slowly
+ currentScore -= 0.3 // If the score is already not high and there is continuous no sending, decrease slowly
} else if warmupStatus.Score > 70 {
currentScore -= 0.2 // If the score is high but there is continuous no sending, decrease very slowly
}
@@ -400,15 +400,15 @@ func (s *SenderIpWarmupService) GetSendingRateFactor(ctx context.Context, sender
// Warmup not complete, and score is very low, or warmup has just begun
if record.Progress < 100 {
- if record.Score < minScoreForSending {
- return 0.0, nil // Pause sending
- }
+ //if record.Score < minScoreForSending {
+ // return 0.0, nil // Pause sending
+ //}
// In the early stages of warmup, the rate should be very low and gradually increase with progress and score
// This is a simplified step-wise increase example
baseProgressFactor := float64(record.Progress) / 100.0
scoreFactor := (float64(record.Score) - float64(minScoreForSending)) / (100.0 - float64(minScoreForSending))
if scoreFactor < 0 {
- scoreFactor = 0
+ scoreFactor = 0.05 // Ensure the score factor is not negative, default to a very cautious rate
}
// Example: a smoother warmup rate = (base progress rate * 0.3) + (score performance rate * 0.7)
@@ -425,7 +425,7 @@ func (s *SenderIpWarmupService) GetSendingRateFactor(ctx context.Context, sender
rate = 1.0
}
if rate < 0 {
- rate = 0
+ rate = 0.05 // Ensure the rate is not negative, default to a very cautious rate
}
g.Log().Debugf(ctx, "GetSendingRateFactor: IP %s (Progress: %d%%, Score: %d) -> In Warmup, Rate Factor: %.2f", senderIp, record.Progress, record.Score, rate)
return rate, nil