aboutsummaryrefslogtreecommitdiff
path: root/deliver_dir.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-13 12:02:49 +0800
committerRunxi Yu <me@runxiyu.org>2025-01-13 12:02:49 +0800
commit42c5f39700c6ba95a6b924be807e8cddd69c3bdd (patch)
treea61dc937793b00684a03a14b2ec4adfca5f632da /deliver_dir.go
parentAdd addresses (diff)
downloadmaild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.gz
maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.tar.zst
maild-42c5f39700c6ba95a6b924be807e8cddd69c3bdd.zip
Add PostgreSQL mail store support
Diffstat (limited to 'deliver_dir.go')
-rw-r--r--deliver_dir.go33
1 files changed, 0 insertions, 33 deletions
diff --git a/deliver_dir.go b/deliver_dir.go
deleted file mode 100644
index bba9eb4..0000000
--- a/deliver_dir.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package main
-
-import (
- "os"
- "time"
-
- "go.lindenii.runxiyu.org/lindenii-common/clog"
- "go.lindenii.runxiyu.org/lindenii-common/misc"
-)
-
-func deliver_to_local_directory(envelope_from string, envelope_recipients []string, data []byte, dir_path string) error {
- clog.Debug(
- "incoming_mail",
- "envelope_from", envelope_from,
- "envelope_recipients", envelope_recipients,
- "data", string(data),
- )
- t := time.Now()
- dir, err := misc.Open_directory_readonly(dir_path)
- if err != nil {
- return misc.Wrap_one_error(err_deliver_write, err)
- }
- fd, err := misc.Open_file_at(dir, envelope_from+" "+t.Format(time.RFC3339Nano)+".eml", os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600)
- if err != nil {
- // TODO: handle fs.ErrExist
- return misc.Wrap_one_error(err_deliver_write, err)
- }
- _, err = fd.Write(data)
- if err != nil {
- return misc.Wrap_one_error(err_deliver_write, err)
- }
- return nil
-}