-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
Linux: | ||
name: Linux Bash | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Script | ||
run: | | ||
bash -e -o pipefail -- sendmsg.sh -h | ||
- name: ShellCheck | ||
run: shopt -s globstar; shellcheck -o avoid-nullary-conditions,check-extra-masked-returns,check-set-e-suppressed,deprecate-which,quote-safe-variables,require-double-brackets -s bash **/*.sh | ||
continue-on-error: true | ||
|
||
Pylint: | ||
name: Pylint | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install pylint | ||
- name: Script | ||
run: pylint -f colorized --py-version 3.7 -d design,C0103,W0311,C0301,C0302,C0209 --load-plugins pylint.extensions.code_style,pylint.extensions.comparison_placement,pylint.extensions.for_any_all,pylint.extensions.consider_refactoring_into_while_condition,pylint.extensions.consider_ternary_expression,pylint.extensions.dict_init_mutate,pylint.extensions.docstyle,pylint.extensions.check_elif,pylint.extensions.set_membership,pylint.extensions.typing -e R6104,C1804,C1805 -r y python-port/ | ||
continue-on-error: true | ||
|
||
Ruff: | ||
name: Ruff | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install ruff | ||
- name: Script | ||
run: ruff --output-format=github --target-version py37 --select F,E4,E7,E9,W,I,D,UP,YTT,ANN,S,BLE,B,A,COM819,C4,T10,EM,EXE,ISC,ICN,G,PIE,PYI,Q,RSE,RET,SLF,SLOT,SIM,TID,TCH,ARG,PGH,PL,TRY,FLY,PERF,FURB,LOG,RUF --preview --ignore W191,D211,D213,D401,PLR09,PLR2004,RUF001,RUF002,RUF003 . | ||
continue-on-error: true | ||
|
||
Python: | ||
name: Linux Python | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Script | ||
run: | | ||
python -X dev python-port/sendpy/ --help |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ set -e | |
SEND=1 | ||
|
||
# To e-mail addresses | ||
# Send SMSs by using your mobile providers e-mail to SMS or MMS gateway (https://en.wikipedia.org/wiki/SMS_gateway#Email_clients) | ||
# Send text messages by using your mobile providers e-mail to SMS or MMS gateway (https://en.wikipedia.org/wiki/SMS_gateway#Email_clients) | ||
TOEMAILS=( | ||
|
||
) | ||
|
@@ -148,34 +148,34 @@ Options: | |
Examples: | ||
Send e-mail | ||
$ $1 -s \"Example\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -t \"User <user@example.com>\" | ||
Send e-mail with message | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -t \"User <user@example.com>\" | ||
Send e-mail with message and single attachment | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -a example.txt -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -a example.txt -t \"User <user@example.com>\" | ||
Send e-mail with message and multiple attachments | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -a example1.txt -a example2.txt -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -m \"This is an example"'!'"\" -a example1.txt -a example2.txt -t \"User <user@example.com>\" | ||
Send e-mail to a CC address | ||
$ $1 -s \"Example\" -t \"Example 1 <example1@example.com>\" -c \"Example 2 <example2@example.com>\" | ||
$ $1 -s \"Example\" -t \"User 1 <user1@example.com>\" -c \"User 2 <user2@example.com>\" | ||
Send e-mail with a From address | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -t \"User <user@example.com>\" | ||
Send e-mail with an external SMTP server | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -t \"User <user@example.com>\" | ||
Send high priority e-mail | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -P \"1 (Highest)\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -P \"1 (Highest)\" -t \"User <user@example.com>\" | ||
Send e-mail digitally signed with an S/MIME Certificate | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -C \"cert.p12\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -C \"cert.p12\" -t \"User <user@example.com>\" | ||
Send e-mail digitally signed with PGP/MIME | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -k \"passphrase\" -t \"Example <example@example.com>\" | ||
$ $1 -s \"Example\" -f \"Example <[email protected]>\" -S \"smtps://mail.example.com\" -u \"example\" -p \"password\" -k \"passphrase\" -t \"User <user@example.com>\" | ||
" >&2 | ||
} | ||
|
||
|
@@ -414,6 +414,11 @@ if [[ -n "$FROMADDRESS" ]] && ! [[ $FROMADDRESS =~ $RE1 && $FROMADDRESS =~ $RE2 | |
fi | ||
|
||
if [[ -n "$CERT" ]]; then | ||
if ! command -v openssl >/dev/null; then | ||
echo "Error: OpenSSL is not installed." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -r "$CERT" && ! -f "$CLIENTCERT" ]]; then | ||
echo "Error: '$CERT' certificate file does not exist." >&2 | ||
exit 1 | ||
|
@@ -422,7 +427,10 @@ if [[ -n "$CERT" ]]; then | |
if [[ ! -s "$CLIENTCERT" ]]; then | ||
echo -e "Saving the client certificate from '$CERT' to '$CLIENTCERT'" | ||
echo -e "Please enter the password when prompted.\n" | ||
openssl pkcs12 -in "$CERT" -out "$CLIENTCERT" -clcerts -nodes | ||
if ! openssl pkcs12 -in "$CERT" -out "$CLIENTCERT" -clcerts -nodes; then | ||
echo "Error saving the client certificate. Trying again in legacy mode." >&2 | ||
openssl pkcs12 -in "$CERT" -out "$CLIENTCERT" -clcerts -nodes -legacy | ||
fi | ||
fi | ||
|
||
# if ! output=$(openssl verify -verify_email "$FROMADDRESS" "$CLIENTCERT" 2>/dev/null); then | ||
|
@@ -451,6 +459,11 @@ if [[ -n "$CERT" ]]; then | |
fi | ||
|
||
if [[ -n "$PASSPHRASE" ]]; then | ||
if ! command -v gpg >/dev/null; then | ||
echo "Error: GNU Privacy Guard is not installed." >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! echo "$PASSPHRASE" | gpg --pinentry-mode loopback --batch -o /dev/null -ab -u "$FROMADDRESS" --passphrase-fd 0 <(echo); then | ||
echo "Error: A PGP key pair does not yet exist for '$FROMADDRESS' or the passphrase was incorrect." >&2 | ||
exit 1 | ||
|