Email notification for new FAQ

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Email notification for new FAQ

Post by coudy » Fri Oct 03, 2014 6:32 am

Hi,
is there a option, or hack how to enable email notification to specific group or email, if new FAQ was created ?
I just found email notification based on question, but this is not what I want.

Thank you

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Fri Oct 03, 2014 9:57 am

Hi,

there's a notification for both new FAQs and new questions.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Fri Oct 03, 2014 10:42 am

could you please navigate me ?
what should be set ? enabled ?
wiki ?
I didn't found it in docs.

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Fri Oct 03, 2014 10:52 am

Hi,

it's enabled by default and cannot be disabled. If a new FAQ is added in the frontend, the admin and a possible category owner will get an e-mail to review/activate the new entry.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Fri Oct 03, 2014 11:18 am

so there is something wrong,
I'm admin, and I have added 52 FAQs, but no email was received.
Users can add FAQs too, but again, no email notification.
I have tried search mail.log, nothing. I'm using postfix.
Could you please tell me more ? what is used to send email ? are there any logs ?
I have version 2.8.14

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Fri Oct 03, 2014 11:21 am

Hi,

if you do not get any mails please check your mail log of your mail server. We just use the plain mail() method in PHP.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Tue Oct 07, 2014 2:24 pm

Hi,
this simple test is working ok,
http://www.w3schools.com/php/php_mail.asp
but emails from FAQ not,
As I mentioned before, nothing in mail.log, no message from FAQ.

Any help ?

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Tue Oct 07, 2014 5:25 pm

Hi,

is the sender aka the admin allowed as "sent from"?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Tue Oct 07, 2014 7:27 pm

Hi,
admin, is my email address, exactly same, which I use in previous test in field FROM.

can I enable debug, or see logs generated by PMF ? Where are they ?

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Wed Oct 08, 2014 5:19 am

Hi,

you can enable the debug mode here: inc/Bootstrap.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Thu Oct 09, 2014 11:36 am

Now I can see errors.
This error show after adding new faq:

Code: Select all

phpMyFAQ user error [256]: Mail Class: is not a valid e-mail address! in /home/www/faq/inc/PMF/Mail.php on line 283
variable $address is empty

Code: Select all

    private function _addEmailTo(&$target, $targetAlias, $address, $name = null)
    {
        // Sanity check
<------>
        if (!self::validateEmail($address)) {
            trigger_error(
                "<strong>Mail Class</strong>: $address is not a valid e-mail address!",
                E_USER_ERROR
            );
            return false;
        }
Why ? I have email address on each account.

Image

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Sat Oct 11, 2014 10:49 am

Hi,

maybe there's a bug during adding it to the function, I'll check it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

faquser_2014
Posts: 2
Joined: Mon Oct 13, 2014 8:36 am

Re: Email notification for new FAQ

Post by faquser_2014 » Mon Oct 13, 2014 9:44 am

Thorsten wrote:Hi,

it's enabled by default and cannot be disabled. If a new FAQ is added in the frontend, the admin and a possible category owner will get an e-mail to review/activate the new entry.

bye
Thorsten
Unfortunately I can't find a piece of code that is responsible for notification on new faq entry that is created with Administration->Add new FAQ record.
Can someone guide me?

I have looked into admin/record.add.php but found only notification if FAQ is an answer to someone's question

Code: Select all

 
$openQuestionId = PMF_Filter::filterInput(INPUT_POST, 'openQuestionId', FILTER_VALIDATE_INT);
            if (null !== $openQuestionId) {

                if ($faqConfig->get('records.enableDeleteQuestion')) { // deletes question
                    $faq->deleteQuestion($openQuestionId);
                } else { // adds this faq record id to the related open question
                    $faq->updateQuestionAnswer($openQuestionId, $recordId, $categories['rubrik'][0]);
                }

                $url   = sprintf(
                    '%s?action=artikel&cat=%d&id=%d&artlang=%s',
                    $faqConfig->get('main.referenceURL'),
                    $categories['rubrik'][0],
                    $recordId,
                    $recordLang
                );
                $oLink = new PMF_Link($url, $faqConfig);

                // notify the user who added the question
                $notifyEmail = PMF_Filter::filterInput(INPUT_POST, 'notifyEmail', FILTER_SANITIZE_EMAIL);
                $notifyUser  = PMF_Filter::filterInput(INPUT_POST, 'notifyUser', FILTER_SANITIZE_STRING);

                $notification = new PMF_Notification($faqConfig);
                $notification->sendOpenQuestionAnswered($notifyEmail, $notifyUser, $oLink->toString());
            }
And only user who added the question get notified.

coudy
Posts: 19
Joined: Wed Feb 05, 2014 9:14 am

Re: Email notification for new FAQ

Post by coudy » Wed Oct 15, 2014 11:26 am

Hi @Thorsten,
so, it is bug ? or it is not implemented ?
Should I create Feature request on GIt, or Bug report ?

Thorsten
Posts: 14744
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Email notification for new FAQ

Post by Thorsten » Sun Oct 19, 2014 4:10 pm

Hi,

yes, please do so! I was on vacation, sorry for the delay.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Post Reply