我使用DigitalOcean创建了一个Droplet,我想将其用作我的邮件服务器。我使用PuTTY访问它。我已安装postfix
和mailutils
个套餐来发送电子邮件。当我使用以下命令发送电子邮件时,它可以正常工作: -
echo "This is the body of the email" | mail -s "This is the subject line" your_email_address
但是,当我尝试使用Bamboo与BambooSMTP适配器的Elixir包Bamboo发送电子邮件时,我收到以下错误: -
** (Bamboo.SMTPAdapter.SMTPError) There was a problem sending the email through SMTP.
The error is :retries_exceeded
More detail below:
{:network_failure, '<ip-address>', {:error, :econnrefused}}
(bamboo_smtp) lib/bamboo/adapters/smtp_adapter.ex:80: Bamboo.SMTPAdapter.handle_response/1
(bamboo) lib/bamboo/mailer.ex:123: Bamboo.Mailer.deliver_now/3
这是我的config.exs
文件: -
config :bamboo_email_smtp, BambooEmailSmtp.Mailer,
adapter: Bamboo.SMTPAdapter,
server: "<ip-address>",
hostname: "<name of my droplet; it is also what I get when I type 'hostname' at the prompt>",
port: 1025,
username: "root", # or {:system, "SMTP_USERNAME"}
password: "<the password I use to login to my droplet>", # or {:system, "SMTP_PASSWORD"}
tls: :if_available, # can be `:always` or `:never`
allowed_tls_versions: [:"tlsv1", :"tlsv1.1", :"tlsv1.2"], # or {":system", ALLOWED_TLS_VERSIONS"} w/ comma seprated values (e.g. "tlsv1.1,tlsv1.2")
ssl: false, # can be `true`
retries: 1,
no_mx_lookups: false # can be `true`
我做错了什么?请帮忙。