Skip to content

Commit

Permalink
update: smtp
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeryoungh committed Dec 16, 2022
1 parent ea29345 commit d5a0d8a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/bin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: github pages

on:
push:
tags:
- 'v*.*.*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- run: cargo build --release && strip -s target/release/github-action-rss

- name: Release
uses: softprops/action-gh-release@v1
with:
files: target/release/github-action-rss
34 changes: 34 additions & 0 deletions scripts/send.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import smtplib as SMTP
import os
from email.mime.text import MIMEText
from email.header import Header

receivers = os.environ['receivers']
mail_user = os.environ['mail_user']

mail_pass = os.environ['mail_pass']
mail_host = os.environ['mail_host']

mail_msg = ''

with open('./build/index.html') as f:
mail_msg = f.read()

message = MIMEText(mail_msg, 'html', 'utf-8')
message['From'] = Header(mail_user, 'utf-8')
message['To'] = Header(receivers, 'utf-8')

subject = 'GitHub Action RSS'
message['Subject'] = Header(subject, 'utf-8')


try:
conn = SMTP.SMTP()
conn.set_debuglevel(1)
conn.connect(mail_host)
conn.login(mail_user, mail_pass)
conn.sendmail(mail_user, receivers, message.as_string())
print('send success!!')
except SMTP.SMTPException:
print('send error!!')

2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async fn main() {

for (k, v) in &s {
let group = if k.is_empty() {
"default".to_string()
"index".to_string()
} else {
k.to_string()
};
Expand Down

0 comments on commit d5a0d8a

Please sign in to comment.