1

Topic: roundcube vacation autoreply

Hi guys,

I installed a vacation plugin for roundcube and after fixing several script errors in it and now works.

master.cf ---------------------------------------------------------------------------------------------------------------------------
vacation  unix  -       n       n       -       -       pipe
  flags=DRhu user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} ${recipient}
-----------------------------------------------------------------------------------------------------------------------------------------

When a user enable his out of office, remote sender get the "out of office" automatic reply BUT the original email is not saved to local user mailbox.

I tryed to add in alias something similar to: "user@domain.com" -> "user#domain.com@autoreply.domain.com,<b>user@domain.com</b>"
but still it dosen't work.

Any ideea?

2

Re: roundcube vacation autoreply

Yes, use the default sieve filters. E.g., new filter, for all incoming mails, action: reply with message.

3

Re: roundcube vacation autoreply

maxie_ro wrote:

Yes, use the default sieve filters. E.g., new filter, for all incoming mails, action: reply with message.

well, i don't want to make a new sieve script foreach user vacation.
Is there a automated way to do this after user enables vacation in roundcube?

If i'm wrong please provide me some tutorial link or something.

tx maxie

4

Re: roundcube vacation autoreply

icedevil wrote:
maxie_ro wrote:

Yes, use the default sieve filters. E.g., new filter, for all incoming mails, action: reply with message.

well, i don't want to make a new sieve script foreach user vacation.
Is there a automated way to do this after user enables vacation in roundcube?

If i'm wrong please provide me some tutorial link or something.

tx maxie


I made a filter rule in roundcube with:
reply with message ... etc

belive me ... this is a hard job for my users smile
My vacation plugin works well but it dosen't save e-mail messages to imbox, this is the only problem. I hope i will find a answer


Tx again maxie

5

Re: roundcube vacation autoreply

Why don't you use the default vacation feature in iRedMail?

6 (edited by icedevil 2010-05-06 21:51:02)

Re: roundcube vacation autoreply

ZhangHuangbin wrote:

Why don't you use the default vacation feature in iRedMail?

i like roundcube filters. i can use it like this, but people from business want separate vacation tab in roundcube settings ...

Thanks!

7

Re: roundcube vacation autoreply

icedevil wrote:

i like roundcube filters. i can use it like this, but people from business want separate vacation tab in roundcube settings ...

Agree. Roundcube filter is not user-friendly.

8 (edited by icedevil 2010-05-07 03:22:57)

Re: roundcube vacation autoreply

ZhangHuangbin wrote:
icedevil wrote:

i like roundcube filters. i can use it like this, but people from business want separate vacation tab in roundcube settings ...

Agree. Roundcube filter is not user-friendly.

If anyone wants to install a vacation plugin to set "out of office" from a user friendly interface:

I used freeBSD 8.0 in this tutorial.

1)-------------------------------------------------------------------------------
pw groupadd vacation
pw useradd vacation -c Virtual\ Vacation -d /nonexistent -g vacation -s /sbin/nologin
mkdir /var/spool/vacation
cp /usr/local/www/postfixadmin/VIRTUAL_VACATION/vacation.pl /var/spool/vacation/
chown -R vacation:vacation /var/spool/vacation/
chmod 700 /var/spool/vacation/
chmod 750 /var/spool/vacation/vacation.pl
2)-------------------------------------------------------------------------------
edit /var/spool/vacation/vacation.pl
{
    $db_type = 'mysql';
    $db_host = 'localhost';
    $db_user = 'vmail';
    $db_pass = 'postfix_sql_password';
    $db_name = 'vmail';
    $syslog = 1;
}

MYSQL GRANTS
mysql> SHOW GRANTS FOR vmail@localhost;
+--------------------------------------------------------------------------------------------------------------+
| Grants for vmail@localhost                                                                                   |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'vmail'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
| GRANT SELECT ON `vmail`.* TO 'vmail'@'localhost'                                                             |
| GRANT INSERT, DELETE ON `vmail`.`vacation` TO 'vmail'@'localhost'                                            |
| GRANT SELECT ON `vmail`.`mailbox` TO 'vmail'@'localhost'                                                     |
| GRANT SELECT, INSERT, DELETE ON `vmail`.`alias` TO 'vmail'@'localhost'                                       |
| GRANT SELECT, INSERT, DELETE ON `vmail`.`vacation_notification` TO 'vmail'@'localhost'                       |
+--------------------------------------------------------------------------------------------------------------+
3)-------------------------------------------------------------------------------
append /usr/local/etc/postfix/master.cf with
vacation  unix  -       n       n       -       -       pipe
  flags=DRhu user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} ${recipient}

edit /usr/local/etc/postfix/main.cf
transport_maps = [...] hash:/usr/local/etc/postfix/vacation
vacation_destination_recipient_limit = 1

[replace autoreply.domain.tld]
echo 'autoreply.domain.tld vacation:' >> /usr/local/etc/postfix/vacation
postmap /usr/local/etc/postfix/vacation

postfix reload

4)-------------------------------------------------------------------------------
- get vacation plugin http://github.com/bhuisgen/rc-vacation/
- copy the plugin to /usr/local/www/roundcube/plugins/
- add ,"vacation" into $rcmail_config['plugins'] - /usr/local/www/roundcube/config/main.inc.php

edit /usr/local/www/roundcube/plugins/vacation/config.inc.php and replace $rcmail_config['vacation_sql_write'] and autoreply.domain.ltd with your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
// write data queries
$rcmail_config['vacation_sql_write'] =
        array("DELETE FROM vacation WHERE email=%email AND " .
                 "domain=%email_domain;",
          "DELETE from vacation_notification WHERE on_vacation=%email;",
          "DELETE FROM alias WHERE address=%email AND " .
                 "domain=%email_domain;",
              "INSERT INTO vacation (email,domain,subject,body,created," .
                 "active) " .
                 "SELECT %email,%email_domain,%vacation_subject," .
                    "%vacation_message,NOW(),1 FROM mailbox " .
                 "WHERE username=%email AND domain=%email_domain AND " .
                    "%vacation_enable=1;",
          "INSERT INTO alias (address,goto,domain,created,modified," .
                 "active) " .
             "SELECT %email,CONCAT(%email_local,'#',%email_domain,'@'," .
                "'autoreply.domain.ltd,',%email_local,'@',%email_domain),%email_domain,NOW(),NOW(),1 " .
             "FROM mailbox WHERE username=%email AND " .
                "domain=%email_domain AND %vacation_enable=1;",
          "INSERT INTO alias (address,goto,domain,created,modified,active) SELECT %email,CONCAT(%email_local,'@',%email_domain),%email_domain,NOW(),NOW(),1 FROM mailbox WHERE username=%email AND domain=%email_domain AND %vacation_enable=0;"
    );

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

ee /var/spool/vacation/vacation.pl

replace: 'ctype' => 'text/plain; charset=UTF-8',
with: 'ctype' => 'text/html; charset=UTF-8',
on line: 443

make a test smile

9

Re: roundcube vacation autoreply

icedevil wrote:

If anyone wants to install a vacation plugin to set "out of office" from a user friendly interface:

I used freeBSD 8.0 in this tutorial.

Thanks. It's works on Centos too.
I have a question. Is it possible to change number of vacation message response? We need to change this value to 10 messages per sender address.
TIA.

10

Re: roundcube vacation autoreply

Excuse me, what do you mean 'number of vacation message'?

Currently, you can set how many responses per-day.

11

Re: roundcube vacation autoreply

ZhangHuangbin wrote:

Excuse me, what do you mean 'number of vacation message'?

I mean, how many messages to one address will be sent if vacation is set on.

Currently, you can set how many responses per-day.

This would be good solution. Can You tell me where I can set this parameter?

PS. Sorry for my English.

12

Re: roundcube vacation autoreply

Currently, you can set how many responses per-day.
This would be good solution. Can You tell me where I can set this parameter?

edit vacation.pl script
[my location][/usr/local/etc/postfix/vacation.pl]
go to line 152 that looks like this:

# notification interval, in seconds
# set to 0 to notify only once
# e.g. 1 day ...
#my $interval = 60*60*24;
# disabled by default
our $interval = 0;

modify $interval variable value;

13

Re: roundcube vacation autoreply

ZhangHuangbin wrote:

Why don't you use the default vacation feature in iRedMail?


Will you tell me where the default vacation feature in iRedMail is please?

Thanks.

14

Re: roundcube vacation autoreply

It's set in roundcube Filter tab, create a new filter with action 'out of office'.

15

Re: roundcube vacation autoreply

ZhangHuangbin wrote:

It's set in roundcube Filter tab, create a new filter with action 'out of office'.


Thanks!  I manually upgraded to Roundcube 0.3.1 a couple of months ago and I never even used the Out of Office features.  Now, many of our users want it.  Is it possible to migrate the sieverules plugin that you added to Roundcube 0.2.1 to Roundcube 0.3.1?  I've tried but I haven't been having any success.

Your help would be greatly appreciated.

16

Re: roundcube vacation autoreply

Ok, but what about if the recipient is an alias? How do I set an autoresponder to an alias?

17

Re: roundcube vacation autoreply

g.ciprian wrote:

Ok, but what about if the recipient is an alias? How do I set an autoresponder to an alias?

you will have to manually add to database.

I never tryed this, i don't even know if it works. Try and tell us smile

18

Re: roundcube vacation autoreply

icedevil wrote:
g.ciprian wrote:

Ok, but what about if the recipient is an alias? How do I set an autoresponder to an alias?

you will have to manually add to database.

I never tryed this, i don't even know if it works. Try and tell us smile

I didn't wanted to get my hands dirty by modifying anything in the database. At most I would loved a sieve conf variant (like here http://wiki.dovecot.org/LDA/Sieve#Vacat … -reply-1), but for an unknown cause it didn't worked for me.
After googling for a half a day after... nothing and being in a hurry I'v converted the alias in a real account in postfixadmin, setup an autoresponder filter in roundcube for it and another one right after wich redirects the emails to another alias created in postfix.
A little quircky, but worked...

19

Re: roundcube vacation autoreply

g.ciprian wrote:
icedevil wrote:
g.ciprian wrote:

Ok, but what about if the recipient is an alias? How do I set an autoresponder to an alias?

you will have to manually add to database.

I never tryed this, i don't even know if it works. Try and tell us smile

I didn't wanted to get my hands dirty by modifying anything in the database. At most I would loved a sieve conf variant (like here http://wiki.dovecot.org/LDA/Sieve#Vacat … -reply-1), but for an unknown cause it didn't worked for me.
After googling for a half a day after... nothing and being in a hurry I'v converted the alias in a real account in postfixadmin, setup an autoresponder filter in roundcube for it and another one right after wich redirects the emails to another alias created in postfix.
A little quircky, but worked...

Quick and dirty vacation auto reply for an alias.  I added a second rule to the vacation seive to redirect message to: real address. then i changed vmail::alias::goto back to the aliased address.

so if the aliased address was mail@alias.com and the real address was mail@real.com then I changed the goto field from mail@real.com to mail@alias.com.