TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.5k stars 221 forks source link

Notify on Amazon SES not working #31

Closed pguizeline closed 5 years ago

pguizeline commented 5 years ago

Hi! First let me thank you for this awesome tool!

I'm trying to enable email notifications on IP changes on Cloudflare, the IP is being correctly updated, I'm running GoDNS as a systemd service on Debian Stretch with an unprivileged dedicated user named "godns". Here's my config.json:

{
  "provider": "Cloudflare",
  "email": "myemail@example.com",
  "password": "password",
  "domains": [
    {
      "domain_name": "domain.com",
      "sub_domains": ["subdomain"]
    }
  ],
  "ip_url": "https://icanhazip.com/",
  "ip_interface": "eth0",
  "socks5_proxy": "",
  "notify": {
    "enabled": true,
    "smtp_server": "email-smtp.us-east-1.amazonaws.com",
    "smtp_username": "username",
    "smtp_password": "password",
    "smtp_port": 587,
    "send_to": "myemail@example.com"
  }
}

I've tried port 25 too but it didn't work. Thanks in advance for any help!

TimothyYe commented 5 years ago

Thanks @pguizeline , is your SMTP server and account/password configured correctly? Maybe you can use some tool to test it first.

pguizeline commented 5 years ago

Hi! Thanks for the fast reply! I'm running GoDNS on a Debian router, and I have Postfix installed and configured to relay all root mail via Amazon Simple Email Service (SES). Emails sent via Postfix work, but via the notify agent on GoDNS don't, is there a way to enable any kind of debugging or verbose on the notify agent?

TimothyYe commented 5 years ago

I think I already found the root cause. There is one issue with the Cloudflare handler, the email notification is not implemented yet. This Cloudflare Handler is submitted by another contributor, maybe he forgot to add it. Anyway, I'll fix it ASAP.

TimothyYe commented 5 years ago

@pguizeline Just released a new version to fix this issue, you may try it. https://github.com/TimothyYe/godns/releases/tag/V1.6.3

pguizeline commented 5 years ago

Hey! Thanks for the patience and the fix! I've tested the new version, now it seems it's trying to send the notification, but something else is happening:

Send email notification with error: gomail: could not send email 1: gomail: invalid address "MY AMAZON USER ID": mail: no angle-addr

My config.json is the same as before, and it seems that it's misinterpreting the fields. Anyway thanks a lot for all the attention and patience!!

TimothyYe commented 5 years ago

invalid address "MY AMAZON USER ID": mail: no angle-addr

Is the email address or email user ID / password configured correctly?

TimothyYe commented 5 years ago

@pguizeline There is another way to test it: try to configure it with your own Gmail or other email accounts.

pguizeline commented 5 years ago

Yup, the credentials are setup just like my postfix relay. I’ve checked the json for any errors but as far as I know it’s correct.

pguizeline commented 5 years ago

That’s a great idea! Let me try with my gmail account.

pguizeline commented 5 years ago

It worked, I think I know what it is, at the JSON, with gmail, the "smtp_username" contains a @, but with Amazon SES it's just a string of letters and numbers without @.

TimothyYe commented 5 years ago

Does Amazon SES provide SMTP account contains @ ?

pguizeline commented 5 years ago

Nope, unfortunately SES uses a format like this:

"smtp_username": "AKIAXXXXXXXXXXXXXXXXXX", "smtp_password": "AXXXXXXXXXXXXXXXXXXXXXXXXXXX",

Both the username and password being a random string of letters and numbers.

pguizeline commented 5 years ago

But don't worry! Using gmail is no problem at all! Thanks again for all your support and help!!!

TimothyYe commented 5 years ago

I think the SMTP package used doesn't support AWS SES.