TLS connection failed

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
Daniel_
Forum Newbie
Posts: 1
Joined: Mon Sep 03, 2007 6:50 am

TLS connection failed

Post by Daniel_ »

Hello,

i'd like to send emails using swiftmailer and tls / LOGIN authentication.

My pretty simple example looks like this

Code: Select all

<?php
require_once('/home/daniel/lib/Swift/Connection/SMTP.php');
require_once('/home/daniel/lib/Swift/Message.php');
require_once('/home/daniel/lib/Swift.php');
require_once('/home/daniel/lib/Swift/Authenticator/LOGIN.php');

$smtp = new Swift_Connection_SMTP('mail.domain.tld', Swift_Connection_SMTP::PORT_DEFAULT, Swift_Connection_SMTP::ENC_TLS);
$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
$smtp->setUsername('username');
$smtp->setPassword('password');

$message = new Swift_Message('test email', 'some text', "text/html");

$swift = new Swift($smtp);
$sent = $swift->send($message, 'my@account.tld', 'from@...');
$swift->disconnect();
?>
unfortunatly I got following error message:

Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [tls://mail.domain.tld:25]: fsockopen returned Error Number 0 and Error String ''' in /home/daniel/lib/Swift/Connection/SMTP.php:309

and the smtp server wrote an error to the logfile:

13:18:58 16240 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=[host] [ip] input="\026\003\001"


Any help is appreciated.

best regards,
Daniel
Post Reply