Commit 9b803385 authored by Dominika Liberda's avatar Dominika Liberda 💽 Committed by Dominika Liberda

added mail handler, bump version to 0.94

parent 8f0d48a5
......@@ -20,9 +20,9 @@ cfg[ssl_cert]=''
cfg[ssl_key]=''
cfg[extension]='shs'
cfg[extra_headers]='server: HTTP.sh/0.93 (devel)'
cfg[extra_headers]='server: HTTP.sh/0.94 (devel)'
cfg[title]='HTTP.sh 0.93'
cfg[title]='HTTP.sh 0.94'
cfg[php_enabled]=false # enable PHP script evalutaion (requires PHP)
cfg[python_enabled]=false # enable Python script evalutaion (requires Python)
......@@ -32,3 +32,10 @@ cfg[log]='log' # filename
# proxy functionality is very WiP
cfg[proxy]=false
cfg[proxy_url]='http://example.com/'
# mail handler config
cfg[mail]=""
cfg[mail_server]=""
cfg[mail_password]=""
cfg[mail_ssl]=true
cfg[mail_ignore_bad_cert]=false
#!/bin/bash
# mail.sh - basic SMTP handler
# mailgen(from, to, subject, msg)
function mailgen() {
echo "From: $1
To: $2
Subject: $3
$4"
}
# mailsend(to, subject, msg)
function mailsend() {
tmp="$(mktemp)"
mailgen "${cfg[mail]}" "$1" "$2" "$3" > "$tmp"
curl \
$([[ ${cfg[mail_ignore_bad_cert]} == true ]] && printf -- "-k") \
$([[ ${cfg[mail_ssl]} == true ]] && printf -- "--ssl") \
"smtp://${cfg[mail_server]}" \
--mail-from "${cfg[mail]}" \
--mail-rcpt "$1" \
--upload-file "$tmp" \
--user "${cfg[mail]}:${cfg[mail_password]}"
rm "$tmp"
}
......@@ -3,6 +3,7 @@ source config/master.sh
source src/mime.sh
source src/misc.sh
source src/account.sh
source src/mail.sh
[[ -f "${cfg[namespace]}/config.sh" ]] && source "${cfg[namespace]}/config.sh"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment