Bamboo SMTP error - (Bamboo.SMTPAdapter.SMTPError) There was a problem sending the email through SMTP

Can anyone help why i am getting this error?

 (exit) an exception was raised:
    ** (Bamboo.SMTPAdapter.SMTPError) There was a problem sending the email through SMTP.

The error is :no_more_hosts

More detail below:

{:permanent_failure, "smtp.gmail.com", "530-5.7.0 Authentication Required. Learn more at\r\n530 5.7.0  https://support.google.com/mail/?p=WantAuthError d18-20020a5d6452000000b00215859413f3sm4737143wrw.107 - gsmtp\r\n"}
1 Like

Not that I know the answer to your question, but I am curious about Bamboo, it has been replaced by swoosh in Phoenix…

I do not know which version of Phoenix You are using.

Recently I updated a Phoenix 1.5 application to 1.6. There was a problem of compatibility (mime 1.4 error)

I saw it’s also less maintained.

1 Like

@kokolegorille i am using bamboo with bamboo_smtp.

Which Phoenix version?

1 Like

Phoenix installer v1.6.10

Gmail is rejecting the credentials that Bamboo is sending; have you tried the troubleshooting steps from the URL in that error message already?

1 Like

yes. i tried it but still getting this error.

now i am getting this error. @al2o3cr

{:network_failure, "domain name", {:error, :timeout}}

If you are using free google smtp service it won’t work. It seems that Google is not providing anymore that service for ordinary gmail account.

I also used it to send mails in dev mode in my Phoenix projects. Now I just switched to Swoosh Smtp. The good thing with Swoosh is that it seems to be more actively maintained than Bamboo now. Swoosh has even a bult-in local email adapter to send mails in dev environment.

In production paid SMTP service is anyway the recommended solution I think or you can roll your own SMTP server ?

1 Like

@Kurisu
swoosh is providing the free google smtp service or not for ordinary gmail account or not ?

@Kurisu

dkim: [
    s: "default", d: "domain.com",
    private_key: {:pem_plain, File.read!("priv/keys/domain.private")}
  ],

whats the private key means?

In fact this does not depend on Swoosh or Bamboo. There is no more free google smtp service.

The Swoosh.Adapters.Local is just a simulation of mails sending. The mails are not actually sent but it is convenient for serving pages useful for previewing emails in development.

You can check its configuration here.

1 Like

Well you can ignore that part of the config if you don’t know what it is. I did it and it just works for me (of course not with free google smtp server).

Below is my config in production:

mailer_cfg = [
  adapter: Swoosh.Adapters.SMTP,
  relay: {:system, "SMTP_SERVER"},
  username: {:system, "SMTP_USER"},
  password: {:system, "SMTP_PASS"},
  ssl: false,
  tls: :if_available,
  auth: :if_available,
  port: 587,
  # dkim: [
  #   s: "default",
  #   d: "domain.com",
  #   private_key: {:pem_plain, File.read!("priv/keys/domain.private")}
  # ],
  retries: 2,
  no_mx_lookups: false
]

config :my_app, MyApp.Mailer, mailer_cfg

config :my_other_app, MyOtherApp.Mailer, mailer_cfg

As you can see I just commented the dkim part. It is not mandatory, my smtp server provider just provides me with a server name, a user name and a password. In the config I read them from environments variables: SMTP_SERVER, SMTP_USER and SMTP_PASS.

That’s it. ^^

@Kurisu that’s not the case. i want to send mail on the gmail account. so what should i use for that???

I don’t want to open that in the browser or something else.
hope you can understand. :slight_smile:

I’m afraid you willl have to use paid solutions for that. Most of the domain registrars will provide you with a smtp server for for basic mail exchanges or notifications though.

Maybe someone will know a still free smtp server solution but you can forget Google.

okay @Kurisu leave gmail for now.
I have my company mail can i use it for this purpose ?

Sendgrid is free for up to 100 mails per day. Good enough for personal use.

1 Like

@derek-zhou what we can use in api_key ?

You still need to register to sendgrid and get a free account. Both Bamboo and Swoosh support Sendgrid pretty well. Also, Sendgrid defaults to mung the links in emails to add tracking, and most likely you don’t want to do that. You need to go in there and disable all tracking.

1 Like

I setup Sendgrid with Swoosh and it was pretty painless to get it working once you get your API key after sign up. I think if you follow along the docs/guides of both you will get it working

1 Like