diff --git a/etc/alternc/templates/apache2/vhost.conf b/etc/alternc/templates/apache2/vhost.conf
index 8a2f4e59..52dadd89 100644
--- a/etc/alternc/templates/apache2/vhost.conf
+++ b/etc/alternc/templates/apache2/vhost.conf
@@ -7,7 +7,7 @@
php_admin_value open_basedir "%%account_root%%:/usr/share/php/"
php_admin_value upload_tmp_dir %%document_root%%/tmp
- php_admin_value sendmail_path '/usr/lib/alternc/sendmail '
+ php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
diff --git a/src/functions_hosting.sh b/src/functions_hosting.sh
index 3cfc569a..ea6226a9 100644
--- a/src/functions_hosting.sh
+++ b/src/functions_hosting.sh
@@ -53,8 +53,9 @@ host_create() {
# First, usefull vars. Some may be empty or false, it's
# OK, it will be solve in the "case" below
local FQDN=$2
- local REDIRECT=$3 # Yes, TARGET_DIR and REDIRECT are the same
- local TARGET_DIR=$3 # It's used by different template
+ local MAIL_ACCOUNT=$3
+ local REDIRECT=$4 # Yes, TARGET_DIR and REDIRECT are the same
+ local TARGET_DIR=$4 # It's used by different template
local USER=$(get_account_by_domain $FQDN)
local U_ID=$(get_uid_by_name "$USER")
local G_ID=$(get_uid_by_name "$USER")
@@ -100,6 +101,7 @@ host_create() {
-e "s#%%redirect%%#$REDIRECT2#g" \
-e "s#%%UID%%#$U_ID#g" \
-e "s#%%GID%%#$G_ID#g" \
+ -e "s#%%mail_account%%#$MAIL_ACCOUNT#g" \
$TMP_FILE
# Check if all is right in the conf file
diff --git a/src/sendmail b/src/sendmail
index ddb1a6e2..4821a4a6 100644
--- a/src/sendmail
+++ b/src/sendmail
@@ -6,7 +6,7 @@ $fr="";
$rt="";
-open(SM,"|/usr/sbin/sendmail -t -i");
+open(SM,"|/usr/sbin/sendmail -t -i -f '".@ARGV[0]."'");
chomp($A=);
while ($A ne "") {
diff --git a/src/update_domains.sh b/src/update_domains.sh
index 05216584..a0d47ba4 100644
--- a/src/update_domains.sh
+++ b/src/update_domains.sh
@@ -66,11 +66,11 @@ done
# sub_domaines.web_action = update and sub_domains.only_dns = false
IFS="$NEWIFS"
mysql_query "
-select concat_ws('$IFS',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), sd.valeur )
-from sub_domaines sd
+select concat_ws('$IFS',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), m.mail, sd.valeur )
+from sub_domaines sd,membres m
where sd.web_action ='UPDATE'
-;" | while read type domain valeur ; do
- host_create "$type" "$domain" "$valeur"
+;" | while read type domain mail valeur ; do
+ host_create "$type" "$domain" "$mail" "$valeur"
mysql_query "update sub_domaines sd set web_action='OK',web_result='$?' where lower(sd.type)='$type' and if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine)='$domain' and sd.valeur='$valeur'; "
echo 1 > "$RELOAD_WEB"
done