Just check the return code of the SwiftMailer send () or batchSend () commands for a non-zero result. If you get a non-zero result (i.e. TRUE), it succeeds in connecting and authenticated to your SMTP service.
:
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
if ($mailer->send($message))
{
echo "Sent\n";
}
else
{
echo "Failed\n";
}