getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

email plugin doesn´t work with ssl / tls #33

Closed gewerbeschule closed 8 years ago

gewerbeschule commented 8 years ago

When I test the plugin with mailtrap.io everything works fine. The configuration in user/config/plugin/email.yaml ist as follows:

enabled: true
from: my@domain.de
to: my@domain.de
mailer:
  engine: smtp
  smtp:
    server: mailtrap.io
    port: 2525
   # encryption: 
    user: 123546
    password:   12345
  sendmail:
    bin: /usr/sbin/sendmail
content_type: text/html
debug: true

When I change the configuration to:

enabled: true
from: xxx@yyy-bergedorf.de
to: xxx@yyyy-bergedorf.de
mailer:
  engine: smtp
  smtp:
    server: smtp.1und1.de
    port: 465
    encryption: ssl
    user: xxx@yyy-bergedorf.de
    password: abcdefg
  sendmail:
    bin: /usr/sbin/sendmail
content_type: text/html
debug: true

I get the following error: 0 - Connection could not be established with host smtp.1und1.de [Connection timed out #110] Log data: ++ Starting Swift_SmtpTransport !! Connection could not be established with host smtp.1und1.de [Connection timed out #110](code: 0)

I tested all combinations of ports and encryptions and also with gmail smtp-server. Any help is appreciated.

flaviocopes commented 8 years ago

Are you sending emails from localhost?

flaviocopes commented 8 years ago

If so, Swiftmailer (user by this plugin) does not support self-signed certificates yet: https://github.com/swiftmailer/swiftmailer/issues/571

Related: https://github.com/getgrav/grav-plugin-email/issues/23

gewerbeschule commented 8 years ago

I am sending the emails from my Webhosting. server 1and1. So it is not from localhost. Thanks for your help.

flaviocopes commented 8 years ago

With mailtrap the same configuration works fine, but as soon as you switch smtp server it does not work any more?

gewerbeschule commented 8 years ago

Yes it is like this. Can I post a log or do you have another sample configuration which works fine?

flaviocopes commented 8 years ago

No actually I don't have an exact answer for this. It works with one, so it should work with the others too, unless it's some underlying problem with the SSL certificate that prevents it to talk correctly to the live SMTP server

gewerbeschule commented 8 years ago

How can I check this with the ssl certificate? Really thanks for your help.

gewerbeschule commented 8 years ago

Solution for the problem: Change the engine in email.yaml from "smtp" to "mail" and it works fine.

flaviocopes commented 8 years ago

By setting "mail" you're using the PHP mail() functionality, not using the SMTP email sending - might work just fine in your case (on some servers it does not work), just be aware that it's not using your SMTP server.

chrisallick commented 5 years ago

If so, Swiftmailer (user by this plugin) does not support self-signed certificates yet: swiftmailer/swiftmailer#571

Related: #23

Any work around for this? I'm on a mac using mailtrap smtp. Was hoping to test before I resort to testing on production.

Edit: I did ssh into dreamhost and ran the test. It did work. I guess I'll just go for it :)