Last active
May 5, 2022 07:32
-
-
Save rafaelcpalmeida/93161b194f8a22d287048529ea59acb4 to your computer and use it in GitHub Desktop.
Send emails with text from a textbox called from crontab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /usr/local/bin/reportSender.sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
export DISPLAY=:0.0 | |
export XAUTHORITY=/home/USER/.Xauthority | |
MAIL="$(zenity --entry --title="Report Sender" --text="O que é que fizeste hoje?")" | |
if [ -z "$MAIL" ] | |
then | |
zenity --info --title="Report Sender" --text="Texto em branco.\nA ignorar..." | |
else | |
swaks --to email1@provider.com,email2@provider.com --from "email1@provider.com" --server smtp.provider.com --auth LOGIN --auth-user "email1@provider.com" --auth-password "Here" -tls --header "Content-Type: text/html; charset=UTF-8\nSubject: Envio de relatório diário\nFrom: John Appleseed <email1@provider.com>" --body "A actividade de hoje foi:<br/><br/><br/>${MAIL}" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment