aboutsummaryrefslogtreecommitdiff
path: root/activitypub/object.go
diff options
context:
space:
mode:
authorFChannel <>2022-06-19 01:39:41 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit0a8c71360230f0439257d56d77a0755bfc030b06 (patch)
tree76e09318aaf71e2e4b90aa538f0ac774b73eb355 /activitypub/object.go
parent25829d2d0e379c323b8f2ae6e7c2aad7548f0a30 (diff)
new line for cookiekey in config-init
Diffstat (limited to 'activitypub/object.go')
-rw-r--r--activitypub/object.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/activitypub/object.go b/activitypub/object.go
index acbe4a1..9e6a97b 100644
--- a/activitypub/object.go
+++ b/activitypub/object.go
@@ -3,6 +3,7 @@ package activitypub
import (
"database/sql"
"fmt"
+ "net/smtp"
"os"
"os/exec"
"regexp"
@@ -1460,3 +1461,23 @@ func (obj ObjectBase) IsLocked() (bool, error) {
return false, nil
}
+
+func (obj ObjectBase) SendEmailNotify() error {
+ actor, _ := GetActorFromDB(obj.Actor)
+
+ from := config.SiteEmail
+ pass := config.SiteEmailPassword
+ to := ""
+ body := fmt.Sprintf("New post: %s", config.Domain+"/"+actor.Name+"/"+util.ShortURL(actor.Outbox, obj.Id))
+
+ msg := "From: " + from + "\n" +
+ "To: " + to + "\n" +
+ "Subject: Image Board Post\n\n" +
+ body
+
+ err := smtp.SendMail(config.SiteEmailServer+":"+config.SiteEmailPort,
+ smtp.PlainAuth("", from, pass, config.SiteEmailServer),
+ from, []string{to}, []byte(msg))
+
+ return util.MakeError(err, "SendEmailNotify")
+}