Codeigniter: SMTP-Mail funktioniert nicht

Ich versuche, ein Kontaktformular einzurichten, und habe Probleme, es mit der SMTP-Konfiguration in CI zum Laufen zu bringen. Ich habe es jedoch erfolgreich mit der grundlegenden Mail-Konfiguration versucht.

Um es kurz zu machen, ich mache meine Tests mit diesem einfachen Code:

    $config = array(
        'protocol' => 'smtp',
        'smtp_host' => 'smtp.1and1.es',
        'smtp_port' => 25,
        'smtp_user' => '[email protected]', 
        'smtp_pass' => '********',
        'mailtype'  => 'text',
        'charset'   => 'utf-8',
        'wordwrap'  => true,
        'wrapchars' => 50            
    );

    $this->load->library('email');
    $this->email->initialize($config);

    $this->email->from('[email protected]');
    $this->email->to('[email protected]');
    $this->email->reply_to('[email protected]', 'John Doe');
    $this->email->subject('Message sent from the contact form in website');
    $this->email->message('Body of message...');

    if ($this->email->send()) {
            return true;
    }
    echo '<!--' . print_r($this->email->print_debugger(), true) . '-->'; 
    return false;

Ich habe gerade meinen Hosting-Provider gefragt und die gesamte SMTP-Konfiguration ist korrekt. Sie haben auch überprüft, ob mein E-Mail-Konto ordnungsgemäß funktioniert.

In der Tat, wenn ich wähle:

protocol => 'mail'

Die Nachricht wird ohne Probleme zugestellt. AFAIK die Funktion php mail () nutzt ebenfalls den Hosting-Provider SMTP, übergibt ihn aber einfach an den Server und vergisst ihn.

Stattdessen möchte ich die SMTP-Authentifizierung verwenden, die sich um den Versand der E-Mail kümmert. Aber nur durch Veränderung

protocol => 'smtp'

Wenn ich das Formular abschicke, ist die Bearbeitungszeit sehr lang und ich erhalte endlich die folgende Debug-Meldung:

220 smtp.1and1.es (mreu2) Welcome to Nemesis ESMTP server

hello:  The following SMTP error was encountered:
Failed to send AUTH LOGIN command. Error: 421 smtp.1and1.es connection timed out

from:  The following SMTP error was encountered:
to:  The following SMTP error was encountered: 
data:  The following SMTP error was encountered:  

The following SMTP error was encountered: 
Unable to send email using PHP SMTP.  Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Thu, 24 Jan 2013 18:51:31 +0100
From: <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Reply-To: "John Doe" <[email protected]>
Subject: =?utf-8?Q?Message_sent_from_the_contact_form_in_website?=
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Body of message...

Was könnte der Grund für diesen Fehler sein?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage