Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Open sidebar
Guilherme Filippo
ISPConfig 3
Commits
26c52828
Commit
26c52828
authored
Dec 17, 2009
by
wyrie
Browse files
Implemented: FS#1003 - Autoresponder: Start and end date (Server)
parent
da488d76
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/conf/autoresponder.master
View file @
26c52828
...
...
@@ -6,13 +6,17 @@ if ($RETURNCODE==1)
{
if (!/^X-Spam-Flag: YES/:h )
{
RESPOND="{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.msg"
RESPONDDB="{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lst"
# The following must be one contiguous line
cc "| mailbot -t $RESPOND -d $RESPONDDB -D 1 \
-A 'From: $RECIPIENT' -s 'Auto Response: from $RECIPIENT' \
/usr/sbin/sendmail -t -f ''"
NOW=time
if ({start_date} lt $NOW && {end_date} gt $NOW)
{
RESPOND="{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.msg"
RESPONDDB="{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lst"
# The following must be one contiguous line
cc "| mailbot -t $RESPOND -d $RESPONDDB -D 1 \
-A 'From: $RECIPIENT' -s 'Auto Response: from $RECIPIENT' \
/usr/sbin/sendmail -t -f ''"
}
}
}
}
...
...
server/plugins-available/maildrop_plugin.inc.php
View file @
26c52828
...
...
@@ -104,11 +104,12 @@ class maildrop_plugin {
exec
(
"chmod 770 "
.
$this
->
mailfilter_config_dir
.
'/'
.
$email_parts
[
1
]
.
'/'
.
$email_parts
[
0
]);
}
// Check if something has been changed regarding the autoresponders
if
(
$data
[
"old"
][
"autoresponder_text"
]
!=
$data
[
"new"
][
"autoresponder_text"
]
or
$data
[
"old"
][
"autoresponder"
]
!=
$data
[
"new"
][
"autoresponder"
]
or
(
isset
(
$data
[
"new"
][
"email"
])
and
$data
[
"old"
][
"email"
]
!=
$data
[
"new"
][
"email"
]))
{
or
(
isset
(
$data
[
"new"
][
"email"
])
and
$data
[
"old"
][
"email"
]
!=
$data
[
"new"
][
"email"
])
or
$data
[
"old"
][
"autoresponder_start_date"
]
!=
$data
[
"new"
][
"autoresponder_start_date"
]
or
$data
[
"old"
][
"autoresponder_end_date"
]
!=
$data
[
"new"
][
"autoresponder_end_date"
])
{
// We delete the old autoresponder, if it exists
$email_parts
=
explode
(
"@"
,
$data
[
"old"
][
"email"
]);
...
...
@@ -123,8 +124,9 @@ class maildrop_plugin {
$file
=
$this
->
mailfilter_config_dir
.
'/'
.
$email_parts
[
1
]
.
'/'
.
$email_parts
[
0
]
.
'/.vacation.msg'
;
if
(
is_file
(
$file
))
unlink
(
$file
)
or
$app
->
log
(
"Unable to delete file:
$file
"
,
LOGLEVEL_WARN
);
$file
=
$this
->
mailfilter_config_dir
.
'/'
.
$email_parts
[
1
]
.
'/'
.
$email_parts
[
0
]
.
'/.autoresponder'
;
if
(
is_file
(
$file
))
unlink
(
$file
)
or
$app
->
log
(
"Unable to delete file:
$file
"
,
LOGLEVEL_WARN
);
if
(
is_file
(
$file
))
unlink
(
$ar_file
)
or
$app
->
log
(
"Unable to delete file:
$ar_file
"
,
LOGLEVEL_WARN
);
//Now we create the new autoresponder, if it is enabled
if
(
$data
[
"new"
][
"autoresponder"
]
==
'y'
)
{
if
(
isset
(
$data
[
"new"
][
"email"
]))
{
...
...
@@ -136,6 +138,15 @@ class maildrop_plugin {
// Load the master template
$tpl
=
file_get_contents
(
$conf
[
"rootpath"
]
.
'/conf/autoresponder.master'
);
$tpl
=
str_replace
(
'{vmail_mailbox_base}'
,
$mail_config
[
"homedir_path"
],
$tpl
);
if
(
$data
[
"new"
][
"autoresponder_start_date"
]
!=
'0000-00-00 00:00:00'
)
{
// Dates have been set
$tpl
=
str_replace
(
'{start_date}'
,
strtotime
(
$data
[
"new"
][
"autoresponder_start_date"
]),
$tpl
);
$tpl
=
str_replace
(
'{end_date}'
,
strtotime
(
$data
[
"new"
][
"autoresponder_end_date"
]),
$tpl
);
}
else
{
$tpl
=
str_replace
(
'{start_date}'
,
-
7200
,
$tpl
);
$tpl
=
str_replace
(
'{end_date}'
,
2147464800
,
$tpl
);
}
// Write the config file.
$config_file_path
=
$this
->
mailfilter_config_dir
.
'/'
.
$email_parts
[
1
]
.
'/'
.
$email_parts
[
0
]
.
'/.autoresponder'
;
file_put_contents
(
$config_file_path
,
$tpl
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment