diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d818c56..57a1be6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,23 +21,24 @@ jobs: send-email: runs-on: ubuntu-latest steps: - - name: install email tool - run: | - yum install -y - yum install -y curl sendmail - - name: send email - env: - SMTP_SERVER: ${{ secrets.SMTP_SERVER }} - SMTP_PORT: ${{ secrets.SMTP_PORT }} - EMAIL_USER: ${{ secrets.EMAIL_USER }} - EMAIL_PASS: ${{ secrets.EMAIL_PASS }} - TO_EMAIL: 1627832236@qq.com - run: | - echo "Subject: 推送仓库成功" > email.txt - echo "From: $EMAIL_USER" >> email.txt - echo "To: $TO_EMAIL" >> email.txt - echo "" >> email.txt - echo "有新的内容推送到仓库toutoukan" >> email.txt - sendmail -S "$SMTP_SERVER:$SMTP_PORT" -au"$EMAIL_USER" -ap"$EMAIL_PASS" $TO_EMAIL < email.txt - + - name: 检出代码仓库 + uses: actions/checkout@v4 + - name: 发送邮件 + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.qq.com + server_port: 465 + username: ${{ secrets.EMAIL_USER }} + password: ${{ secrets.EMAIL_PASS }} + subject: "推送仓库成功" + body: | + 通知:有新的内容已推送到仓库「toutoukan」的 main 分支!! + + 推送时间: ${{ github.run_started_at }} + 推送作者: ${{ github.actor }} + 提交信息: ${{ github.event.head_commit.message || '无提交信息' }} + to: 1627832236@qq.com + from: ${{ secrets.EMAIL_USER }} + # 如果使用 SSL + secure: true