You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bamboo发送邮件报错:DigitalOcean Droplet邮件服务器Postfix正常但适配器异常

Hey there! Let's figure out why your Bamboo SMTP setup is failing when the system-level mail command works perfectly on your DigitalOcean Droplet. Here are the most common issues and how to fix them:

1. Verify Bamboo SMTP Configuration vs. Postfix Behavior

The mail command uses Postfix's local delivery (often via Unix socket or trusted localhost access), but Bamboo connects over TCP—so mismatches here are the first thing to check:

  • Server & Port: Ensure your Bamboo config points to localhost (or 127.0.0.1) and the correct port. Postfix typically listens on port 25 for local unauthenticated traffic, or 587 for submission with authentication. Double-check your config/config.exs (or runtime config) for:
    config :my_app, MyApp.Mailer,
      adapter: Bamboo.SMTPAdapter,
      server: "localhost",
      port: 25,
      # ... other settings
    
  • Authentication: The mail command skips auth because it's a local system user, but if Postfix has smtpd_sasl_auth_enable = yes in main.cf, you need to add valid credentials to Bamboo (matching Postfix's SASL users). If auth isn't required, set username: nil and password: nil.
  • TLS Settings: If Postfix doesn't enforce TLS on port 25, setting tls: :always in Bamboo will cause errors. Try tls: :never first for testing, or align it with Postfix's smtpd_tls_security_level value in main.cf.
2. Check Postfix Access Controls

Postfix might be blocking Bamboo's connection even though it lets the mail command through:

  • mynetworks Configuration: In /etc/postfix/main.cf, make sure mynetworks includes 127.0.0.1/32 (localhost). This tells Postfix to trust connections from the local machine without auth. If it's missing, add it:
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    
  • Recipient Restrictions: Ensure smtpd_recipient_restrictions in main.cf has permit_mynetworks listed before restrictive rules like reject_unauth_destination. This ensures local connections are allowed first.
3. Debug the SMTP Flow

Get concrete details about what's failing:

  • Enable Bamboo Debugging: Add debug: true to your Bamboo config. This will print the full SMTP conversation in your logs, showing exactly where the error occurs (e.g., EHLO rejection, auth failure).
  • Check Postfix Logs: Run tail -f /var/log/mail.log (on Debian/Ubuntu) while trying to send via Bamboo. The logs will show Postfix's exact reason for rejecting the connection—look for lines like Client rejected: Access denied or SASL authentication failed.
4. Test SMTP Manually

Rule out Bamboo-specific issues by simulating the connection yourself:
Use telnet or nc to connect to Postfix directly:

telnet localhost 25
# Once connected:
EHLO localhost
MAIL FROM:<your_local_user@your_droplet_domain>
RCPT TO:<your_email_address>
DATA
Subject: Manual SMTP Test
This is a test email sent directly via SMTP
.
QUIT

If this manual test fails, the problem is in Postfix's configuration. If it succeeds, double-check every parameter in your Bamboo config for typos or mismatches.


内容的提问来源于stack exchange,提问作者Sh4dy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:00:01