feat: email forwarding via SMTPS
Parallel to Bark: when email forwarding is enabled and a recipient is set, notifications are also sent via SMTP over SSL (port 465, SMTPS). Works standalone — no Bark server required. - core/EmailSender: SMTP over SSL (implicit TLS, port 465), AUTH LOGIN, UTF-8 subject/body via Base64/MIME; trySend() fire-and-forget helper - SettingsStore: 7 email settings (enabled, host, port, user, password, from, to) - NotifyListenerService + PhoneCallMonitor: call EmailSender.trySend in parallel with Bark forwarding; fires even if no Bark servers configured - UI: new "电邮转发" SectionCard in settings (toggle + host/port/user/ password/from/to fields + save button) - version 1.6.0 -> 1.6.1 (code 10 -> 11); CLAUDE.md synced Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import android.service.notification.NotificationListenerService
|
||||
import android.service.notification.StatusBarNotification
|
||||
import com.a2i.forwarder.A2iApp
|
||||
import com.a2i.forwarder.core.BarkSender
|
||||
import com.a2i.forwarder.core.EmailSender
|
||||
import com.a2i.forwarder.core.ForwardLog
|
||||
import com.a2i.forwarder.core.NotificationProcessor
|
||||
import com.a2i.forwarder.core.PendingPush
|
||||
@@ -61,6 +62,7 @@ class NotifyListenerService : NotificationListenerService() {
|
||||
val servers = app.settings.servers.value.filter { it.enabled && it.deviceKey.isNotBlank() }
|
||||
if (servers.isEmpty()) {
|
||||
app.logStore.addLog(ForwardLog(now, sbn.packageName, d.appLabel, msg.title, msg.body, "failed", "未配置可用 Bark 服务器"))
|
||||
EmailSender.trySend(app, msg.title ?: d.appLabel, msg.body, scope)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -74,5 +76,6 @@ class NotifyListenerService : NotificationListenerService() {
|
||||
PendingPush(UUID.randomUUID().toString(), now, servers.first().id, json.encodeToString(msg))
|
||||
)
|
||||
}
|
||||
EmailSender.trySend(app, msg.title ?: d.appLabel, msg.body, scope)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user