Problém s SMTP Mailer server/local
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Wailey
- Člen | 48
Zdravím vás,
jsem už v nouzi na jednom webhostingu konkrétně na czechia.com,
když se napojím na SMTP na localu bez problému to funguje, avšak když se napojím na serveru háže mi vyjímku konkrétně
Nette\Mail\SmtpException: in /www/sites/9/site35699/public_html/vendor/nette/mail/src/Mail/SmtpMailer.php:123 @ http://domena.cz/?…
config
parameters:
php:
date.timezone: Europe/Prague
# zlib.output_compression: yes
nette:
container:
accessors: TRUE
mailer:
smtp: true
host: smtp.domena.cz
secure: ssl
username: ***
password: ***
application:
errorPresenter: Error
mapping:
*: App\*Module\Presenters\*Presenter
services:
email:
class: \Email
router: App\RouterFactory::createRouter
use Nette\Http\IReques,
Nette\Bridges\ApplicationLatte\UIMacros,
\Nette\Utils\Strings,
Nette\Mail\Message;
class Email extends \Nette\Object {
/** @var \Nette\Mail\IMailer @inject */
public $mailer;
/** @var Nette\Application\IPresenter */
private $presenter;
/** @var Latte\Engine */
private $latte;
public function __construct(Nette\Mail\IMailer $mailer, Nette\Application\Application $application) {
$this->mailer = $mailer;
$this->presenter = $application->getPresenter();
$this->latte = new Latte\Engine();
UIMacros::install($this->latte->getCompiler());
}
public function send($to, $template, $params = array()) {
$mail = new Message;
$params['_presenter'] = $this->presenter;
$params['_control'] = $this->presenter;
$params['host'] = $this->presenter->url->host;
$mail->setFrom("info@domena.cz")
->addTo($to)
->addTo("info@domena.cz")
->setHtmlBody($this->latte->renderToString($template, $params));
$this->mailer->send($mail);
}
}
sendAsk.latte je template pro email
Nedokážu specifikovat vyjímku, ani vyhledat chybu, chvíli to fungovalo a pak z ničeho nic chyba … na localu to jede.. Spěchá prosím o pomoc
- Wailey
- Člen | 48
[2015–09–08 11–47–55] Nette\Mail\SmtpException: in /www/sites/9/site35699/public_html/vendor/nette/mail/src/Mail/SmtpMailer.php:123 @ http://rhtransport.cz/?… @@ exception-2015–09–08–11–34–40-c03f63abeab3f582537b32917b6a2e09.html
- Wailey
- Člen | 48
Nette\Mail\SmtpException
search►
Source file
Call stack
.../vendor/nette/mail/src/Mail/SmtpMailer.php:75 source Nette\Mail\SmtpMailer-> connect ()
65: /**
66: * Sends email.
67: * @return void
68: */
69: public function send(Message $mail)
70: {
71: $mail = clone $mail;
72:
73: try {
74: if (!$this->connection) {
--> 75: $this->connect();
76: }
77:
78: if (($from = $mail->getHeader('Return-Path'))
79: || ($from = key($mail->getHeader('From')))
.../app/model/Email.php:39 source Nette\Mail\SmtpMailer-> send (arguments)
29:
30: $params['_presenter'] = $this->presenter;
31: $params['_control'] = $this->presenter;
32: $params['host'] = $this->presenter->url->host;
33:
34: $mail->setFrom("info@rhtransport.cz")
35: ->addTo($to)
36: ->addTo("info@rhtransport.cz")
37: ->setHtmlBody($this->latte->renderToString($template, $params));
38:
--> 39: $this->mailer->send($mail);
40: }
41: }
.../app/presenters/HomepagePresenter.php:50 source Email-> send (arguments)