I have a simple code for sending mails. sometime $host
might not available or my SMTP
server might be down but what happens in these cases swiftmailer
throws lot of exceptions and $result
despite of returning true
or false
give me a complete mess of errors.
so how i can turn off the errors for this page of code but not for the whole library?
$transport = Swift_SmtpTransport::newInstance(self::$host, 25)
->setUsername(self::$username)
->setPassword(self::$password);
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance("Custom Sheets");
$message->setFrom(array('EDB@abc.com.pk' => 'Approval of Custom Duty Sheet'));
$message->setTo($to);
$message->setBody($html,'text/html');
//Send the message
$result = $mailer->send($message);