Skip to content

Commit d5a0d8a

Browse files
committed
update: smtp
1 parent ea29345 commit d5a0d8a

3 files changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/bin.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: github pages
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- run: cargo build --release && strip -s target/release/github-action-rss
15+
16+
- name: Release
17+
uses: softprops/action-gh-release@v1
18+
with:
19+
files: target/release/github-action-rss

scripts/send.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import smtplib as SMTP
2+
import os
3+
from email.mime.text import MIMEText
4+
from email.header import Header
5+
6+
receivers = os.environ['receivers']
7+
mail_user = os.environ['mail_user']
8+
9+
mail_pass = os.environ['mail_pass']
10+
mail_host = os.environ['mail_host']
11+
12+
mail_msg = ''
13+
14+
with open('./build/index.html') as f:
15+
mail_msg = f.read()
16+
17+
message = MIMEText(mail_msg, 'html', 'utf-8')
18+
message['From'] = Header(mail_user, 'utf-8')
19+
message['To'] = Header(receivers, 'utf-8')
20+
21+
subject = 'GitHub Action RSS'
22+
message['Subject'] = Header(subject, 'utf-8')
23+
24+
25+
try:
26+
conn = SMTP.SMTP()
27+
conn.set_debuglevel(1)
28+
conn.connect(mail_host)
29+
conn.login(mail_user, mail_pass)
30+
conn.sendmail(mail_user, receivers, message.as_string())
31+
print('send success!!')
32+
except SMTP.SMTPException:
33+
print('send error!!')
34+

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ async fn main() {
248248

249249
for (k, v) in &s {
250250
let group = if k.is_empty() {
251-
"default".to_string()
251+
"index".to_string()
252252
} else {
253253
k.to_string()
254254
};

0 commit comments

Comments
 (0)