/** * For Admin CP->Setup->Email 'test' function */ function testAction() { check_demo(); $config = $this->getDi()->config; foreach ($this->getRequest()->toArray() as $k => $v) { $config->set($k, strip_tags($v)); } $m = new Am_Mail(); $m->addTo($this->getParam('email'), 'Test E-Mail')->setSubject('Test E-Mail Message from aMember ')->setBodyText("This is a test message sent from aMember CP\n\nURL: " . htmlentities(ROOT_URL)); try { $m->send(new Am_Mail_Queue($config)); } catch (Exception $e) { echo "<span class='error'>Error during e-mail sending: " . get_class($e) . ":" . $e->getMessage() . "</span>p "; return; } $f = current(Am_Mail::getDefaultFrom()); $e = htmlentities($this->getParam('email')); $tm = date('Y-m-d H:i:s'); print "<p>Message has been sent successfully. Please wait 2 minutes and check the mailbox <i>{$e}</i>.<br />" . "There must be a message with subject [Test E-Mail]. Do not forget to check <i>Spam</i> folder.</p><br />" . "<p>If the message does not arrive shortly, contact your webhosting support and ask them to find <br />" . "in <b>mail.log</b> what happened with a message sent from <i>{$f}</i> to <i>{$e}</i> at {$tm}</p>"; }
/** * For Admin CP->Setup->Email 'test' function */ function testAction() { check_demo(); $config = $this->getDi()->config; foreach ($this->getRequest()->toArray() as $k => $v) { $config->set($k, strip_tags($v)); } $m = $this->getDi()->mail; $m->addTo($this->getParam('email'), 'Test E-Mail')->setSubject('Test E-Mail Message from aMember ')->setBodyText("This is a test message sent from aMember CP\n\nURL: " . htmlentities(ROOT_URL)); try { $m->send(new Am_Mail_Queue($config)); } catch (Exception $e) { echo '<span class="error">' . ___('Error during e-mail sending') . ': ' . get_class($e) . ':' . $e->getMessage() . '</span>'; return; } $f = current(Am_Mail::getDefaultFrom()); $e = htmlentities($this->getParam('email')); $tm = date('Y-m-d H:i:s'); print ___('<p>Message has been sent successfully. Please wait 2 minutes and check the mailbox <em>%s</em>.<br />' . 'There must be a message with subject [Test E-Mail]. Do not forget to check <em>Spam</em> folder.</p>' . '<p>If the message does not arrive shortly, contact your webhosting support and ask them to find <br />' . 'in <strong>mail.log</strong> what happened with a message sent from <em>%s</em> to <em>%s</em> at %s</p>', $e, $f, $e, $tm); }