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??
The error you're seeing, "Connection to process /usr/sbin/sendmail -bs has been closed unexpectedly," typically indicates an issue with sending mail from your server using the Sendmail program. Since you're using Mailgun for email delivery, you shouldn't need to rely on Sendmail at all.
Your problem might be related to the way SilverStripe is trying to send emails in the live environment, possibly falling back to a default Sendmail configuration because of some reason. Here are steps to help diagnose and fix the issue:
Check Configuration Values: Ensure that the environmental variables MAILGUN_SMTP_USERNAME and MAILGUN_SMTP_PASSWORD are correctly set and accessible in the live environment.
Ensure SwiftMailer Configuration: Make sure you're using SwiftMailer as the mailer. Add this configuration to your app/_config/email.yml: