Email event usage refactoring

7 views
Skip to first unread message

Alexander Obuhovich

unread,
Mar 14, 2012, 1:09:33 PM3/14/12
to In-Portal Development
Currently e-mail event sending process (internally) doesn't represent real world model, which makes it hard to improve this code with new features.

I'm proposing to:
  1. create kEmail class with following public methods:
    • findEvent($name, $type)
    • setParams($params)
    • send()
  2. make $this->sender refer to kEmailSendingHelper class instance for easy access across all methods
  3. move existing code from EmailEventsEventHandler into new kEmail class
  4. replace OnEmailEvent event sending with new kEmail class usage
At the end interface of kApplication::EmailEventUser and kApplication::EmailEventAdmin will be almost the same (will return true/false instead of kEvent object), so no need to change code to make it working again.

Usually nobody relies on e-mail sent fact in their code anyway.




--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Dmitry A.

unread,
Mar 15, 2012, 6:26:46 PM3/15/12
to in-por...@googlegroups.com
I am excited and looking forward to testing this work Alex!

DA

Dmitry A.

unread,
May 30, 2012, 1:19:10 AM5/30/12
to in-por...@googlegroups.com
Hi Alex,


Ran a test case of email after Email functionality was Refactored -  the test case was when system sends out PLAIN text email to Admin during User Registration.

In result I got:

======== 
A new user "test" has been added.
Sincerely,
Website administration
========

Which means it worked just fine and In-Portal tag was correctly processed in this Email Template:

A new user "<inp2:u.register_Field name='Username'/>" has been added.



DA

Alexander Obuhovich

unread,
May 30, 2012, 5:23:37 AM5/30/12
to in-por...@googlegroups.com
Trick was to have only HTML part of e-mail event to be entered. Then during html-to-plain-text conversion all <inp2:.../> tags will be stripped from it.

Dmitry A.

unread,
May 30, 2012, 11:28:02 PM5/30/12
to in-por...@googlegroups.com
Hi Alex,

Yes, you are right - I confirm the error - replicated on my host.


New task created:

1307: In-Portal Tags Stripped during HTML-to-Plain text Conversion - http://tracker.in-portal.org/view.php?id=1307


DA
Reply all
Reply to author
Forward
0 new messages