Mail avec quoted-printable

This commit is contained in:
croax 2022-09-14 22:18:24 +02:00 committed by croax
parent 3b20742a57
commit 774b65510c
3 changed files with 23 additions and 10 deletions

View File

@ -1,11 +1,8 @@
#!/bin/sh #!/bin/sh
users_num_robot=13
echo -n "Pre-processing..." echo -n "Pre-processing..."
users_num_all=$( ls /home/ | wc -w ) users_num_all=$( wc -l /etc/postfix/virtual_members | awk '{print $1 - 1}')
users_num_human=$(( $users_num_all-$users_num_robot ))
size_home=$( du -sh /home | awk '{print $1}' ) size_home=$( du -sh /home | awk '{print $1}' )
size_per_user=$( du -h --max-depth=1 /home | sort -rh ) size_per_user=$( du -h --max-depth=1 /home | sort -rh )
@ -15,5 +12,5 @@ echo "[done]"
echo "Total number of mailboxes: " $users_num_all echo "Total number of mailboxes: " $users_num_all
echo "Number of real human mail users: " $users_num_human echo "Number of real human mail users: " $users_num_human
echo "Home storage: " $size_home echo "Home storage: " $size_home
echo "Users: " #echo "Users: "
echo $size_per_user | xargs -n 2 echo #echo $size_per_user | xargs -n 2 echo

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
if [ $# -ne 3 ] ; then if [ $# -ne 3 ] ; then
echo -e "Params:\t<username> <contact@email> <password>" >&2 echo -e "Params:\t<username> <contact@email> <password>" >&2
@ -11,13 +11,19 @@ password=$3
echo -n "Sending mail to \"$email\" for account creation \"$user\"..." echo -n "Sending mail to \"$email\" for account creation \"$user\"..."
date=$( date -R ) date=$( date -R )
sendmail $email <<EOF
headers=$(cat<< EOF
From: Commission Infrastructure <cominfra@a-lec.org> From: Commission Infrastructure <cominfra@a-lec.org>
To: <$email> To: <$email>
Date: $date Date: $date
Subject: Mise en place de vos services Subject: Mise en place de vos services
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
EOF
)
message=$(cat <<EOF
Bonjour, Bonjour,
Suite à votre adhésion à l'association Libre en Communs, Suite à votre adhésion à l'association Libre en Communs,
@ -64,7 +70,9 @@ Commission Infrastructure,
Libre en Communs Libre en Communs
. .
EOF EOF
)
echo -e "$headers\n\n$( echo "$message" | recode ...UTF-8/QP )" | sendmail -t
echo "[OK]" echo "[OK]"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
if [ $# -ne 2 ] ; then if [ $# -ne 2 ] ; then
echo -e "Params:\t<username> <contact@email>" >&2 echo -e "Params:\t<username> <contact@email>" >&2
@ -12,13 +12,18 @@ date=$( date -R )
echo -n "Sending mail to \"$email\": account redirection from \"$user\"..." echo -n "Sending mail to \"$email\": account redirection from \"$user\"..."
sendmail $email <<EOF headers=$(cat<<EOF
From: Commission Infrastructure <cominfra@a-lec.org> From: Commission Infrastructure <cominfra@a-lec.org>
To: <$email> To: <$email>
Date: $date Date: $date
Subject: Mise en place de vos services Subject: Mise en place de vos services
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
EOF
)
message=$(cat <<EOF
Bonjour, Bonjour,
Suite à votre adhésion à l'association Libre en Communs, Suite à votre adhésion à l'association Libre en Communs,
@ -57,5 +62,8 @@ Commission Infrastructure,
Libre en Communs Libre en Communs
. .
EOF EOF
)
echo -e "$headers\n\n$( echo "$message" | recode ...UTF-8/QP )" | sendmail -it
echo "[OK]" echo "[OK]"