Author Topic: Autoresponder  (Read 32962 times)

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #15 on: July 23, 2007, 02:36:52 PM »
:) no no no no money it's for the community :)

as translations ... well you just have to modify two files
   program/localization/en_US/labels.inc
          $labels[’autoreply’]
          $labels[’titleautoreply’]
          $labels[’activeautoreply’]
          $labels[’textautoreply’]
and
   program/localization/en_US/messages.inc
          $messages[’autoreplymodified’]
          $messages[’noautoreply’]

but you have to remember to encode it using UTF-8

ehh what do i do at work ? :) let me say i'm not a php programmer so please don't blame me for dirty hacks :)

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22

Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #17 on: July 23, 2007, 09:30:32 PM »
hi sardzent,

first of all: thank you very much that you took some of your 'after work time' already today..!

..I tried - but could not really succeed.. yet.
When I click on the Autoreply-Tab in the RC-Interface it sends me to a completely empty page - no error message, no nothing in the source code - just blank....

I actually followed step 0 to 9 and I think I did everything ok - only two or actually three questions arose on the way.. the first question would be a very small/minor problem, the second one already a bit larger - and the third one I don't really understand at all.. - ..here we go:

1) under step2 you suggest to edit the code of func.inc - I fear/suppose there' one comma ->,<- too much at the end of the line
   'autoreply' => 'rcmail_autoreply_form',
 and I suggest that in the end it should probably look like this:

// register UI objects
$OUTPUT->add_handlers(array(
 'userprefs' => 'rcmail_user_prefs_form',
 'itentitieslist' => 'rcmail_identities_list',
 'autoreply' => 'rcmail_autoreply_form'
));

2) under step5 I was editing both functions function rcmail_save_autoreply and rcmail_autoreply_form($attrib) in autoreply.inc so that it suits my db-login like something like this:

   @ $DB_1 = new mysqli('localhost', 'dbusername', 'dbpassword', 'dbname');

..actually dbusername and dbname are the same at my db - so it didn't really matter if I mixed them..

anyways - I am not sure if I should also change

   $adnet_id = $_SESSION['adnet_id'];

to something else..? is 'adnet_id' used everywhere else..? ..or do I need to change even more in these two functions..?

3) and last but not least - I still don't really have the slightest idea how this plug-in actually works - does it still need it's own db-tables..? Or does it actually try to contact/update the actual mailserver-db-tables..? The reason I'm asking are these lines:

   $RESULT_1 = $DB_1->query('SELECT autoreplay_set , autoreplay_value FROM mail_accounts WHERE id = \'' . $adnet_id . '\'');

..where a db-table 'mail_accounts' is needed....

Well well well.. - ..I hope you still got the nerves and some 'after work time' left..?

greetings from berlin, till..

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #18 on: July 24, 2007, 02:31:19 AM »
hello again ;D

1. you are right it shuld be

// register UI objects
$OUTPUT->add_handlers(array(
 'userprefs' => 'rcmail_user_prefs_form',
 'itentitieslist' => 'rcmail_identities_list',
 'autoreply' => 'rcmail_autoreply_form'
));

i made a mistake, because i have few more plugins so ... it was my mistake :)

2. $adnet_id = $_SESSION['adnet_id'];
this is variable in which i store user id in mta table, it's there only to make easy to update my table, if you have simmilar table or relations in database just edit this, if you have in mta table email address then just skip it ;)

3. this plugin connects direct to mta database and updates one table (mail_accounts), changes rows "autoreplay_set" and "autoreplay_value", but to edit/change this values first i'm getting it from table and puts on template.

As you can see you have to modify not only SELECT but also UPDATE query

P.S. yes if there is a blank page there's php error, this comma you wrote about.

greetings from warsaw


Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #19 on: July 24, 2007, 05:11:23 AM »
hello again  :)

well well welll - I think this is now the right moment to contact+ask my provider again.. my problems might arise from the mta table you mentioned - which I cant even see.. so I don't know if the plugin can connect to it - and if the field names are correct and so on..

I'll keep you updated and write whatever comes out from this.. - ..I just hope so much that I'll get it workin somehow.. :D

greetings, t..

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #20 on: July 24, 2007, 05:26:04 AM »
no problem :)
I glad to hear that i was usefull ;)

Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #21 on: July 24, 2007, 08:27:07 PM »
well - still not there yet......

now the support team of my provider said, that they're using a config-file to do the autoresponder trick.. So basically it would be necessary to modify that - which on the other hand they would not allow me.

If I understood them correctly One way/possibility could still be that we're trying to do the trick through a bridge like db-table.. which I could modify through your your script and which would then write to their config-file..

Well - would it be possible that you could tell me/ send me the structure of that db-table you're writing to..? And/or maybe you could also tell me a little bit more about the "mta database" you were mentioning.. I think neither I nor them know what that is and what mta stands for (I suppose it's not the http://www.mta.info ;) )

greetings again, till..

PS: one idea just popped up: do you think using a cron job for a 'fake' responder could be prommissing/practical..? ..I am basically going to develop some more drupal websites - and I would anyways need the webmail+responder for those only.. and there seems to be a rc-module and also some other webmail-modules already -- maybe that could be some way around the 'bridge'-problem..:]

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #22 on: July 25, 2007, 03:52:59 AM »
Hello again :)

Hmm autoresponder content in file and mta daemon checks if the file is present and then serve a content of it .. i suppose

My database ... needed tables and views

-- users mailboxes
CREATE TABLE mail_accounts (
    id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    admin_id INT(11) UNSIGNED NOT NULL,
    active INT(1) NOT NULL DEFAULT '1',
    locked INT(1) NOT NULL DEFAULT '0',
    user_name VARCHAR(255) NOT NULL DEFAULT '',
    domain_id INT(11) UNSIGNED NOT NULL,
    forward_value VARCHAR(255) NOT NULL DEFAULT '',
    alias_value TEXT NOT NULL DEFAULT '',
    permited_mode INT(1) NOT NULL DEFAULT '0',
    permited_senders TEXT NOT NULL DEFAULT '',
    autoreplay_set INT(1) NOT NULL DEFAULT '0',
    autoreplay_days INT(5) NOT NULL DEFAULT '1',
    autoreplay_value TEXT NOT NULL DEFAULT '',
    homedir VARCHAR(512) NOT NULL DEFAULT '/var/mail/boxes',
    maildir VARCHAR(512) NOT NULL DEFAULT '/var/mail/boxes',
    spam_scan INT(1) NOT NULL DEFAULT '1',
    spam_purge INT(1) NOT NULL DEFAULT '1',
    spam_folder INT(1) NOT NULL DEFAULT '0',
    spam_report_days INT(2) NOT NULL DEFAULT '0',
    remote_account INT(1) NOT NULL DEFAULT '0',
    remote_server VARCHAR(128) NOT NULL DEFAULT '',
    fullname VARCHAR(255) NOT NULL DEFAULT '',
    description TEXT NOT NULL DEFAULT '',
    uid INT(6) UNSIGNED NOT NULL DEFAULT '79',
    gid INT(6) UNSIGNED NOT NULL DEFAULT '79',
    passwd_crypt VARCHAR(128) NOT NULL DEFAULT '',
    passwd_plain VARCHAR(128) NOT NULL DEFAULT '',
    bandwidth_limit INT(5) UNSIGNED NOT NULL DEFAULT '1',
    message_limit INT(5) UNSIGNED NOT NULL DEFAULT '1',
    quota_limit INT(5) UNSIGNED NOT NULL DEFAULT '1',
    quota_usage INT(16) NOT NULL DEFAULT '0',
    quota_warning INT(3) NOT NULL DEFAULT '95',
    transfer_speed INT(5) UNSIGNED NOT NULL DEFAULT '1',
    forget_question VARCHAR(255) NOT NULL DEFAULT 'Favorite ISP',
    forget_anwser TEXT,
    imap_enabled INT(1) NOT NULL DEFAULT '1',
    pop3_enabled INT(1) NOT NULL DEFAULT '1',
    webmail_enabled INT(1) NOT NULL DEFAULT '1',
    add_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    mod_date TIMESTAMP NOT NULL DEFAULT '2020-01-01 23:59:00',
    exp_date TIMESTAMP NOT NULL DEFAULT '2020-01-01 23:59:00',
    CHECK ( active IN ('1','0') ),
    CHECK ( locked IN ('1','0') ),
    CHECK ( permited_mode IN ('1','0') ),
    CHECK ( autoreplay_set IN ('1','0') ),
    CHECK ( spam_scan IN ('1','0') ),
    CHECK ( spam_purge IN ('1','0') ),
    CHECK ( spam_folder IN ('1','0') ),
    CHECK ( remote_account IN ('1','0') ),
    CHECK ( imap_enabled IN ('1','0') ),
    CHECK ( pop3_enabled IN ('1','0') ),
    CHECK ( webmail_enabled IN ('1','0') ),
    PRIMARY KEY(id),
    CONSTRAINT mail_accounts_key1 FOREIGN KEY (admin_id) REFERENCES user_accounts(id) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT mail_accounts_key2 FOREIGN KEY (domain_id) REFERENCES mail_domains(id) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT mail_accounts_key3 FOREIGN KEY (bandwidth_limit) REFERENCES bandwidth_limits(id) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT mail_accounts_key4 FOREIGN KEY (message_limit) REFERENCES quota_space(id) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT mail_accounts_key5 FOREIGN KEY (quota_limit) REFERENCES quota_space(id) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT mail_accounts_key6 FOREIGN KEY (transfer_speed) REFERENCES transfer_limits(id) ON DELETE CASCADE ON UPDATE CASCADE,
    UNIQUE KEY mail_accounts_UIDX1(user_name,domain_id)
) TYPE=InnoDB COMMENT='Mail Accounts';


-- imap
CREATE VIEW v_daemon AS SELECT mail_accounts.id AS id , mail_accounts.user_name AS account , v_domain_real.domain AS domain , mail_accounts.passwd_crypt AS passwd_crypt , mail_accounts.passwd_plain AS passwd_plain , mail_accounts.uid AS uid , mail_accounts.gid AS gid , CONCAT(mail_accounts.user_name,'@',v_domain_real.domain) AS email , mail_accounts.homedir AS homedir ,mail_accounts.fullname AS fullname , mail_accounts.maildir AS maildir , IF(quota_space.value !='0',CONCAT(quota_space.value,'M'),quota_space.value) AS quota , mail_accounts.locked AS locked FROM mail_accounts JOIN ( v_domain_real , quota_space ) ON ( mail_accounts.domain_id = v_domain_real.id AND mail_accounts.quota_limit = quota_space.id ) WHERE mail_accounts.exp_date > NOW() AND mail_accounts.active = '1' AND mail_accounts.alias_value = '' ;


first one is a table where to i save autoresponder settings and the second one is used for getting user is (in RC plugin called $adnet_id)

mta stands for "message transfer agent" :)
"mta database" in my case means that all settings needed to handle mail processing are stored in database (MySQL) and MTA daemon (exim) is "reading" whole configuration of accounts from database (no need to reload after changes for example)

you wrote about some "bridge", parsing from database to file ... it's nice beacuse you don't have to develop your own tools to handle autoresponse (all done by mta daemon), but parsing takes some time, and have to be done every 5 min for example, which is not the best solution, beacuse it needs cron, memory, cpu and temporary database / table.

maybe (if apache have access to path where autoresponder config files are stored) you should modify RC plugin to direct create / edit autoreponder files? get some template from your hoster and try :)

Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #23 on: July 25, 2007, 11:43:04 AM »
thank you very very much for all you efforts - at the moment I just can't see how I'm going to be able to implement your plugin with my website/provider.. Now they even have installed RC and the plugin on some test account - but the problem seems to be that the config-file is not reachable for the script - probably due to security reasons... :-\

Well - now I really don't know what to do - maybe I'll try to find someone who could write some 'fake autoresponder' that would work through a dedicated cron job...? ..we'll see..... - ..I'll keep you updated..

greetings +best wishes, till..


Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #24 on: July 25, 2007, 12:17:37 PM »
fake autoresponder in cron is not a good idea,
maybe better set some store and forward to another account and at this account run via procmail for example script which will parse incoming message and then send replay to sender ?

Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #25 on: July 25, 2007, 12:54:21 PM »
"fake autoresponder in cron is not a good idea" - that's also what my provider said - but why should it not be a good idea..?! ..if I just check for new mail twice an hour..? ..at least I would hope that this would be a working alternative...:]

the other option you suggested is probably not really practicable for my purpose: having dozends (one day maybe even hundrets) of users that would want to take controll of their autoresponders.. I fear that I would end up having the same problem I have right now: either I have one interface with one password which I would have to hand out to all the users - or I would need one person that would take care of all the users' autoresponder wishes - or did I understand something wrong..?

greetings, till..

Offline sardzent

  • Jr. Member
  • **
  • Posts: 22
Re: Autoresponder
« Reply #26 on: July 25, 2007, 03:24:47 PM »
why it's not good idea ? hmmm let suppose you checked new emails via pop3 and send response. user did not download email, you checking once again and sending new message or you will have to manage other database with ids of messages that response you already send, whats more you should also manage how offen mta daemon should send messages as a respond (for example once per day to every sender), and of couse to ignore bounces and mailing lists. and the most important is that cron task will have rewrite / set sender address while sending emails, and this may be disallowed by your hoster :) every time getting username, password then do smtp auth and send or maybe you would like to use as a render address one global address (for example out@domain.foo) for emails.

hmmm forwarding do "special" account maybe isn't so bad ofter all.
one selected email account with procmail to manage all autoresponses. i don't know how does you database look like, but maybe you cat update direct via php script table with this setting (then mod my plugin), and that would be easy to do.

greeting from windy warsaw

Offline Florianer

  • Full Member
  • ***
  • Posts: 102
Re: Autoresponder
« Reply #27 on: July 30, 2007, 06:39:01 AM »
@Tille: Just a little question: Who is your provider?
I'm also interested in an autoresponder and I'm working on it... OK, at first, on the background info. I'm writing with the All-Inkl.com Support and maybe I have something I/we can work with. But don't expect it tomorrow ^^ - just, if you are interested in progress: I'm working on the AXAJ Head Rush book and I'm now on page 167 of 400. Hope, I get it soon. If so and I have enough time, I may try to do my first RC work starting with this autoresponder. (And go on to help with these nice calendar plug in.)
it\'s not a bug - it\'s a feature


Offline bradyjfrey

  • Newbie
  • *
  • Posts: 1
Re: Autoresponder
« Reply #28 on: August 01, 2007, 01:35:36 PM »
Daniel, I just sent you an email from my corporate office - we'd be willing to pay your time to customize this into english, with a how-to, install instructions, and stability testing. Caveat of course is that you give it right back to the open source community:) Please contact me here or from the email I sent if you're interested. Thank you, I've been waiting for something like this - especially since Postfix AutoResponder implementation leaves little to be desired on the user end.

FYI, more information on me:
http://dotfive.com/talent/
http://www.google.com/search?client=safari&rls=en&q=%22brady+J+frey%22&ie=UTF-8&oe=UTF-8

This would be for the large client I referenced in the email - we're located in San Francisco California.

Offline tille

  • Newbie
  • *
  • Posts: 9
Re: Autoresponder
« Reply #29 on: August 01, 2007, 03:34:29 PM »
@ Florianer: Hello +hallo to Karlsruhe - from Berlin..:]

..wellwellwell - my provider is also all-inkl..!! :D
Since Daniel's script won't work over there - or actually 'they' won't let it work - I am very much interested in a workaround that would work with all-inkl.. They also suggested that I could do 'my own' implementation - and I actually thought of learning from Daniel's approach - but actually at the moment I am still stuck in a pile of unpaid bills on the one side and unfinished projects on the other side - so I hardly have the time and space I'd love to have to get into this....

But maybe I can let you already know what I got from the all-inkls: if one would provide them with a scrip (form) that would send the username, the password, the autoresponder-subject and -text then they would be able to 'catch' this input and 'forward' it to the appropriate script.. - ..at least that's what they told me..:]

Hope you'll be more successful with this than I was so far..?¿ ..and yes - I won't expect much anything for tomorrow anyways.. :)

greeetings, till..