×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Easiest way to get email notification on front end submission
Jason L
New Member
Posts: 2
4 года 1 мес. назад #9797
от Jason L
Jason L создал тему: Easiest way to get email notification on front end submission
I have created a component using component creator where registered users can submit items, before those items can be displayed I need to have a admin approve these in the backend. All of this functionality is working great.
As we can go weeks without a submission, I would like to be able to email an alert to approver when and item has been submitted and or an items is awaiting approval.
I thought about doing this through cron but would like to have something built into Joomla either via plugin or a modification to the component that was created.
Thoughts I can do basic hacking / code modification of a samples
As we can go weeks without a submission, I would like to be able to email an alert to approver when and item has been submitted and or an items is awaiting approval.
I thought about doing this through cron but would like to have something built into Joomla either via plugin or a modification to the component that was created.
Thoughts I can do basic hacking / code modification of a samples
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Travis
New Member
Posts: 1
4 года 1 мес. назад #9798
от Travis
Travis ответил в теме Easiest way to get email notification on front end submission
If it were me, I would edit /components/com_[componentname]/controllers/[viewname]form.php
Find the save function, right before the redirect, and add:
Find the save function, right before the redirect, and add:
$mail = Factory::getMailer();
$config = Factory::getConfig();
$sender = [$config->get('mailfrom'), $config->get('fromname')];
$mail->setSender($sender);
//Can also do something to get admins or email from param if you don't want to hardcode this.
$mailer->addRecipient('johndoe@example.com');
$body = '<h1>Success!</h1> This is the body of your message. You can do things here.';
$mail->setBody($body);
$mail->isHtml(true);
$mail->Send();
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Время создания страницы: 0.051 секунд