Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
232ee913
authored
Dec 14, 2023
by
Calcium-Ion
Committed by
GitHub
Dec 14, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #30 from YOMIkio/email
fix: add Date header for email
parents
a88c2f0e
cc4c7ca5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
common/email.go
+3
-1
No files found.
common/email.go
View file @
232ee913
...
...
@@ -6,6 +6,7 @@ import (
"fmt"
"net/smtp"
"strings"
"time"
)
func
SendEmail
(
subject
string
,
receiver
string
,
content
string
)
error
{
...
...
@@ -16,8 +17,9 @@ func SendEmail(subject string, receiver string, content string) error {
mail
:=
[]
byte
(
fmt
.
Sprintf
(
"To: %s
\r\n
"
+
"From: %s<%s>
\r\n
"
+
"Subject: %s
\r\n
"
+
"Date: %s
\r\n
"
+
"Content-Type: text/html; charset=UTF-8
\r\n\r\n
%s
\r\n
"
,
receiver
,
SystemName
,
SMTPFrom
,
encodedSubject
,
content
))
receiver
,
SystemName
,
SMTPFrom
,
encodedSubject
,
time
.
Now
()
.
Format
(
time
.
RFC1123Z
),
content
))
auth
:=
smtp
.
PlainAuth
(
""
,
SMTPAccount
,
SMTPToken
,
SMTPServer
)
addr
:=
fmt
.
Sprintf
(
"%s:%d"
,
SMTPServer
,
SMTPPort
)
to
:=
strings
.
Split
(
receiver
,
";"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment