Bonjour,
J'ai ajouté un formulaire de contact à mon site avec swiftmailer, en dev je recevais bien les mail mais une fois passé en production je me retrouve avec un tas d'erreurs.
J'ai vu sur cette Pull Request que swiftmailer utilise sendmail, je suis donc allé voir sur le site de mon hebergeur et cette fonction est activé.
J'ai fais un factory comme dans le tuto "mise en pratique de la poo en php"
<?php
namespace Framework;
use Psr\Container\ContainerInterface;
class SwiftMailerFactory
{
public function __invoke(ContainerInterface $container): \Swift_Mailer
{
if ($container->get('env') === 'prod') {
$transport = new \Swift_SendmailTransport();
} else {
$transport = new \Swift_SmtpTransport('localhost', 1025);
}
return new \Swift_Mailer($transport);
}
}
Warning: proc_open() has been disabled for security reasons in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 291
Notice: Undefined offset: 2 in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 292
Warning: stream_set_blocking() expects parameter 1 to be resource, null given in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 292
Notice: Undefined offset: 2 in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 293
Warning: stream_get_contents() expects parameter 1 to be resource, null given in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 293
Fatal error: Uncaught Swift_TransportException: Expected response code 220 but got an empty response in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:448 Stack trace: #0 /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(361): Swift_Transport_AbstractSmtpTransport->assertResponseCode() #1 /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(147): Swift_Transport_AbstractSmtpTransport->readGreeting() #2 /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php(50): Swift_Transport_AbstractSmtpTransport->start() #3 /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(65): Swift_Transport_SendmailTransport->start() #4 /storage/ssd4/411/16324411/src/Contact/Action/ContactAction.php(39): Swift_Mailer->send() #5 [internal function]: App\Contact\Action\ContactActi in /storage/ssd4/411/16324411/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 448
Oui, tu peux surement virer ton cache et ton log ^^
directement depuis tes fichiers
sinon symfony console cache:clear