GitHub创建Github Action流水线来定时发送天气预报给email

WhoKnows1 / 2023-05-18 / 原文

 

1、基本原理

curl wttr.in
curl wttr.in/Shanghai
curl wttr.in/wuhan

 

 

 

2、参考文章

基于GITHUB ACTION的定时任务,真香!
https://blog.csdn.net/qq_40748336/article/details/110749375

上文参考的文章

GitHub Actions 入门教程_阮一峰
http://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html
GitHub Actions 教程:定时发送天气邮件
http://www.ruanyifeng.com/blog/2019/12/github_actions.html
GITHUB ACTION 官方文档
https://docs.github.com/en/actions

 

阮一峰的天气预报推送邮箱github地址

https://github.com/ruanyf/weather-action/actions/runs/1482726321

 

3、参考上文遇到的问题

0邮件发送失败

定时发送天气预报能发了,原因是qq邮箱要开通smtp协议,qq邮箱还取消了额外密码保护,另外最重要的是action.yaml里面的secrets.MAIL_PASSWORD不是邮箱密码,是授权码。

额外密码保护能否加上不确定,稍后试一下——TODO
 

定时发送天气预报能发了!


但是还有其它问题
1 qq邮箱没有渲染HTML标签
2 那个命令wttr失效了
3 页面结果也是外国人的风格

 
1解决方案

-- content_type这个参数应该是取消了,同时要用html_body代替body

具体见下面截图

 Warning: Unexpected input(s) 'content_type', valid inputs are ['connection_url', 'server_address', 'server_port', 'secure', 'username', 'password', 'subject', 'to', 'from', 'body', 'html_body', 'cc', 'bcc', 'reply_to', 'in_reply_to', 'ignore_cert', 'convert_markdown', 'attachments', 'priority']