swiftmailer mail_send.php error 500-Internal-Server-Error (Log: Timed Out)
<p>My System: </p>

<ul>
<li>Operating System: Linux VServer </li>
<li>Webserver: apache2 Mailserver (Using IMAP): Dovecot </li>
<li>MTA (MailTransportAgent): Postfix + postfix.admin(webapp) to administrate </li>
<li>my Domain: acegames.de (137.74.140.78) </li>
<li>TLS-Mail-encryption via port 465 is working</li>
</ul>

<p>What i want to do:</p>

<p>Execute (Button on website->javascript->ajax->php) php script mail_send.php (+ query) to send mail with swiftmail functions.
Swiftmail should use my postfix SMTP-Server to send the mail.
The swiftmail files are located in <strong>/var/www/html/ts/swiftmailer/</strong>.</p>

<p><strong>this is <a href="http://ts.acegames.de/mail_send.php" rel="nofollow noreferrer">http://ts.acegames.de/mail_send.php</a> 
or /var/www/html/ts/mail_send.php:</strong></p>

<pre><code>&lt;?php 
require_once 'swiftmailer/lib/swift_required.php';

$error = $_GET['err']; $time = $_GET['time']; $user = $_GET['user'];

$transport = Swift_SmtpTransport::newInstance('acegames.de', 465);
$transport-&gt;setUsername("USER@acegames.de");
$transport-&gt;setPassword("PASS");


$mailer = Swift_Mailer::newInstance($transport);


$message = Swift_Message::newInstance('Teamspeak Error Report');
$message-&gt;setFrom(array('USER@acegames.de' =&gt; 'USER'));
$message-&gt;setTo(array('report@acegames.de' =&gt; 'ts3 report'));
$message-&gt;setBody(
'&lt;html&gt;' . 
' &lt;head&gt;&lt;/head&gt;' . 
' &lt;body&gt;' . 
' &lt;p&gt;Reported Error: ' . $error . '&lt;/p&gt;' . 
'  &lt;p&gt;Time: ' . $time . '&lt;/p&gt;' . 
'  &lt;p&gt;User: ' . $user . '&lt;/p&gt;' . 
' &lt;/body&gt;' . 
'&lt;/html&gt;', 'text/html' );




// Send the email 
$result = $mailer-&gt;send($message); 
?&gt;
</code></pre>

<p>But what i get is a 500-INTERNAL_SERVER_ERROR and the following log:
<strong>/var/log/apache2/error.log:</strong></p>

<pre><code>[:error] [pid 23732] [client 188.174.41.220:49670] PHP Fatal error:   Uncaught exception 'Swift_TransportException' with message 'Connection
to acegames.de:465 Timed Out'  in
/var/www/html/ts/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:404\nStack
trace:\n#0 
/var/www/html/ts/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(289):
Swift_Transport_AbstractSmtpTransport-&gt;_getFullResponse(0)\n#1 
/var/www/html/ts/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(117):
Swift_Transport_AbstractSmtpTransport-&gt;_readGreeting()\n#2 
/var/www/html/ts/swiftmailer/lib/classes/Swift/Mailer.php(79):
Swift_Transport_AbstractSmtpTransport-&gt;start()\n#3 
/var/www/html/ts/mail_send.php(36):
Swift_Mailer-&gt;send(Object(Swift_Message))\n#4 {main}\n  thrown in 
/var/www/html/ts/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
on line 404, referer: https://ts.acegames.de/
</code></pre>

<p>I dont know what the issue is. Ive searched through every logfile (mail.log,syslog,apache2 logs,...) but i havent found anything related to this error. </p>