Contact form error : Swift_TransportException

Grav v1.7.25
GPM Releases Configuration: Stable

Hello,

I’ve tried to follow the documentation to create a contact form on my site using Quark theme:

https://learn.getgrav.org/17/forms/forms/example-form

But I’ve this error message :

Swift_TransportException
Expected response code 220 but got an empty response Log data: ++ Starting Swift_SendmailTransport !! Expected response code 220 but got an empty response (code: 0)

I can’t understand clearly the log :

#49 
/home/user/public_html/grav/system/src/Grav/Common/Debugger.php(546): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors\{closure}() 

#50 /home/user/public_html/grav/system/src/Grav/Common/Processors/InitializeProcessor.php(131): Grav\Common\Debugger->profile() 

#51 /home/user/public_html/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process() 

#52 /home/user/public_html/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() 

#53 
/home/user/public_html/grav/system/src/Grav/Common/Grav.php(303): Grav\Framework\RequestHandler\RequestHandler->handle() 

#54 /home/user/public_html/grav/index.php(58): Grav\Common\Grav->process() 

#55 {main} [] []

Thank’s

Basically you posted first 6 lines of log (it’s in reverse). The trace that matters should be at the top IIRC

Thanks Karmalakas ! Here is the message, but it don’t help me really … :

[2021-12-19 19:30:27] grav.CRITICAL: Expected response code 220 but got an empty response Log data: ++ Starting Swift_SendmailTransport !! Expected response code 220 but got an empty response (code: 0) - Trace: 

#0 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailerswiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php(138): Swift_Plugins_LoggerPlugin->exceptionThrown() 

#1 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php(116): Swift_Events_SimpleEventDispatcher->bubble() #2 /var/www/clients/client78/web434/
web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(435): Swift_Events_SimpleEventDispatcher->dispatch
Event() 

#3 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(448): 
Swift_Transport_AbstractSmtpTransport->throwException() 

#4 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(361): Swift_Transport_AbstractSmtpTransport->assertResponseCode() 

#5 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(147): Swift_Transport_AbstractSmtpTransport->readGreeting() 

#6 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php(50): Swift_Transport_A
bstractSmtpTransport->start() 

#7 
/var/www/clients/client78/web434/web/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(65): Swift_Transport_SendmailTransport->start() 

#8 

/var/www/clients/client78/web434/web/user/plugins/email/classes/Email.php(111): Swift_Mailer->send() #9 /var/www/clients/client78/web434/web/user/plugins/email/email.php(167): Grav\Plugin\Email\Email->send() 

#10 

/var/www/clients/client78/web434/web/user/plugins/email/email.php(106): Grav\Plugin\EmailPlugin->sendFormEmail() 

#11
 /var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\EmailPlugin->onFormProcessed() 

#12 
/var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() 

#13 /var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners() 

#14 /var/www/clients/client78/web434/web/system/src/Grav/Common/Grav.php(568): Symfony\Component\EventDispatcher\EventDispatcher->dispatch() 

#15 
/var/www/clients/client78/web434/web/user/plugins/form/classes/Form.php(940): Grav\Common\Grav->fireEvent() #16 /var/www/clients/client78/web434/web/user/plugins/form/form.php(280): Grav\Plugin\Form\Form->post() 

#17 /var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\FormPlugin->onPageInitialized()

#18 
/var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatc
her.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() 

#19 
/var/www/clients/client78/web434/web/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners() 

#20 
/var/www/clients/client78/web434/web/system/src/Grav/Common/Grav.php(568): Symfony\Component\EventDispatcher\EventDispatcher->dispatch() 

#21 
/var/www/clients/client78/web434/web/system/src/Grav/Common/Processors/PagesProcessor.php(59): Grav\Common\Grav->fireEvent() 

#22 /var/www/clients/client78/web434/web/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process() 

#23 
/var/www/clients/client78/web434/web/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() 

#24 
/var/www/clients/client78/web434/web/system/src/Grav/Common/Processors/TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle() 

#25 
/var/www/clients/client78/web434/web/system/src/Grav/Framework/RequestHandler/Traits/RequestHand

Maybe there is no sendmail on the server and I should use smtp instead :

email.yaml


mailer:
  engine: sendmail
  smtp:
    server: localhost
    port: 25
    encryption: none
    user: ''
    password: ''
    auth_mode: ''
  sendmail:
    bin: '/usr/sbin/sendmail -bs'
content_type: text/html
debug: true
Swift_TransportException
grav.CRITICAL: Expected response code 220 but got an empty response Log data: ++ Starting Swift_SendmailTransport !! Expected response code 220 but got an empty response (code: 0) 

I don’t know what is this error, even with the logs I don’t understand.
code 220 ? code 0 ?

Sorry, don’t know either :frowning:

I don’t know why I had to change sendmail to smtp.
If someone have an explanation, I’m interested.

mailer:
engine: smtp
smtp:
server: localhost
port: 25