Nette\Mail\SmtpMailer na port 587 → certificate verify failed

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
motorcb
Člen | 551
+
0
-

Zdravím,

pokouším se posílat emaily přes port 587 (jiný port na hostingu není povolen) ale na SMTP nemam pro tento port certifikat. Je možné nějak nastavit aby se nebrala v potaz důvěryhodnot certifikátu?

Dostávám hlášku: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

$mailer = new \Nette\Mail\SmtpMailer(array(
    'host' => 'xxx.xxx.xxx.xxx',
    'port' => 587,
    'username' => 'user@emailcz',
    'password' => 'pass',
    'secure' => 'tls'
));

Díky

Renyl
Člen | 6
+
0
-

doplnil jsem si tam options pro stream context a funguje mi to. Chyba to je nejspíš kvůli certifikátu, který je potřeba od verze 5.6 defaultně předávat

...
		if ((int) $this->read() !== 250) {
			$this->write("HELO $self", 250);
		}

		stream_context_set_option($this->connection, 'ssl', 'verify_peer', FALSE);
		stream_context_set_option($this->connection, 'ssl', 'verify_peer_name', FALSE);
		stream_context_set_option($this->connection, 'ssl', 'allow_self_signed', TRUE);


		if ($this->secure === 'tls') {
...