galilee
galilee

Reputation: 461

Silverstripe throwing sendmail error on ForgotPassword form and member password change

I'm having an issue where trying to use the ForgotPassword form, or trying to change a users existing password in admin/Security throws the following error:

Connection to "process /usr/sbin/sendmail -bs" has been closed unexpectedly.

This happens in a production site where SS_ENVIRONMENT_TYPE="live" but not when I change it to "dev"

I have the following config for email using Mailgun:

---
Name: myemailconfig
After:
  - '#emailconfig'
Only:
  environment: 'live'
---
SilverStripe\Core\Injector\Injector:
  Swift_Transport:
    class: Swift_SmtpTransport
    properties:
      Host: smtp.mailgun.org
      Port: 587
      Encryption: tls
    calls:
      Username: [ setUsername, ['`MAILGUN_SMTP_USERNAME`'] ]
      Password: [ setPassword, ['`MAILGUN_SMTP_PASSWORD`'] ]
      AuthMode: [ setAuthMode, ['login'] ]

Any ideas why this would be happpening or what the fix could be??

Upvotes: 0

Views: 292

Answers (1)

galilee
galilee

Reputation: 461

Ok, so it turns out Silverstripe has moved to using symfony/mailer from SS5, which I hadn't picked up on. So the fix was pretty easy - changing around the config to use MAILER_DSN, and adding the mailgun bridge to the project composer require symfony/mailgun-mailer

Upvotes: 1

Related Questions