Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit 3e0d351

Browse files
committed
added SendMail function
1 parent 9e30b1c commit 3e0d351

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

sendmail.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package backend
2+
3+
// EmailData used to request the send email process
4+
type EmailData struct {
5+
From string `json:"from"`
6+
To string `json:"to"`
7+
Subject string `json:"subject"`
8+
Body string `json:"body"`
9+
ReplyTo string `json:"replyTo"`
10+
}
11+
12+
func SendMail(token, from, to, subject, body, replyTo string) (ok bool, err error) {
13+
data := EmailData{
14+
From: from,
15+
To: to,
16+
Subject: subject,
17+
Body: body,
18+
ReplyTo: replyTo,
19+
}
20+
err = Post(token, "/sudo/sendmail", data, &ok)
21+
return
22+
}

storage.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func DownloadFile(token, fileURL string) ([]byte, error) {
5353
return buf, err
5454
}
5555

56+
// DeleteFile deletes the file from storage and remove from space used for
57+
// this account
5658
func DeleteFile(token, id string) (ok bool, err error) {
5759
err = Get(token, fmt.Sprintf("/sudostorage/delete?id=%s", id), &ok)
5860
return

0 commit comments

Comments
 (0)