Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send Verification Email #269

Closed
kmanojkumar opened this issue Jan 30, 2020 · 14 comments
Closed

Unable to send Verification Email #269

kmanojkumar opened this issue Jan 30, 2020 · 14 comments

Comments

@kmanojkumar
Copy link

It took me around 6 hours to install kutt in a DO 2GB Ubuntu droplet. Finally, I am able to create short URLs now. All the information I fount to install is https://github.com/thedevs-network/kutt#setup

Using the latest version of Redis, PostgreSQL, and NodeJS.

My .env file looks like this.

# App port to run on
PORT=3000

# The domain that this website is on
DEFAULT_DOMAIN="example.in"

# Generated link length
LINK_LENGTH=6

# Postgres database credential details
DB_HOST=localhost
DB_PORT=5432
DB_NAME=postgres
DB_USER=example
DB_PASSWORD=exampleDGfc
DB_SSL=false

# ONLY NEEDED FOR MIGRATION !!1!
# Neo4j database credential details
NEO4J_DB_URI="bolt://localhost"
NEO4J_DB_USERNAME=neo4j
NEO4J_DB_PASSWORD=BjEphmupAf1D5pDD

# Redis host and port
REDIS_HOST="127.0.0.1"
REDIS_PORT=6379
REDIS_PASSWORD=

# The daily limit for each user
USER_LIMIT_PER_DAY=50

# Create a cooldown for non-logged in users in minutes
# Set 0 to disable
NON_USER_COOLDOWN=0

# Max number of visits for each link to have detailed stats
DEFAULT_MAX_STATS_PER_LINK=5000

# Use HTTPS for links with custom domain
CUSTOM_DOMAIN_USE_HTTPS=false

# A passphrase to encrypt JWT. Use a long and secure key.
JWT_SECRET=securekey

# Admin emails so they can access admin actions on settings page
# Comma seperated
ADMIN_EMAILS=manoj@example.com

# Invisible reCaptcha secret key
# Create one in https://www.google.com/recaptcha/intro/
RECAPTCHA_SITE_KEY=6LcaIdQUAAAAAFhdffffxxH1YMB-EH7M_CGPMA9f
RECAPTCHA_SECRET_KEY=6LcaIdQUAAAAAPVIyffzGLeyR6rg5JB6zNkGQ5qA

# Google Cloud API to prevent from users from submitting malware URLs.
# Get it from https://developers.google.com/safe-browsing/v4/get-started
GOOGLE_SAFE_BROWSING_KEY=

# Google Analytics tracking ID for universal analytics.
# Example: UA-XXXX-XX
GOOGLE_ANALYTICS=
GOOGLE_ANALYTICS_UNIVERSAL=

# Google Analytics tracking ID for universal analytics
# This one is used for links
GOOGLE_ANALYRICS_UNIVERSAL=

# Your email host details to use to send verification emails.
# More info on http://nodemailer.com/
# Mail from example "Kutt <support@kutt.it>". Leave empty to use MAIL_USER
MAIL_HOST=email-smtp.ap-south-1.amazonaws.com
MAIL_PORT=587
MAIL_SECURE=true
MAIL_USER=AKIA6IIMGQ7J5MJ6DO44
MAIL_FROM=example-notifications@example.com
MAIL_PASSWORD=BNddX2mmO4SBprnLAmKPgOwHJIDYc/uSlpCOH5kLmEvS

# The email address that will receive submitted reports.
REPORT_EMAIL=example@example.com

# Support email to show on the app
CONTACT_EMAIL=example@example.com
  • Actual secret values are changed above.

  • I have opened port 587 as well.

I am just getting An error occurred. Any idea where and how can I debug this?

I am unable to figure out why the emails are not being sent. These AWS SES credentials are working fine in other applications. I haven't found anywhere where I can check the logs of the same. As the emails are not being sent, I am unable to authenticate as well.

Please guide.

@poeti8
Copy link
Member

poeti8 commented Jan 30, 2020

Which endpoint is giving that error?

@kmanojkumar
Copy link
Author

Which endpoint is giving that error?

POST /api/auth/signup
POST /api/url/report

if this is what you meant by an endpoint.

@kmanojkumar
Copy link
Author

Any solution that can help? @poeti8

@poeti8
Copy link
Member

poeti8 commented Feb 3, 2020

Seems like your email config is wrong.

@kmanojkumar
Copy link
Author

kmanojkumar commented Feb 3, 2020

I don't know, you may be right. But, the credentials are working fine in another PHP application. However, I have manually verified now in Postgres, to gain access.

Thanks!

@denny64
Copy link

denny64 commented Apr 20, 2020

@kmanojkumar How did you fix this issue?

@hugomd
Copy link
Contributor

hugomd commented May 14, 2020

@denny64 You may have already solved this, but you can connect to the database, go to the users table, find your user, and retrieve the verification_token, then put that in a URL:

https://kutt.example/verify/YOUR_VERIFICATION_TOKEN

Replacing YOUR_VERIFICATION_TOKEN with the token you retrieved.

SQL to retrieve verification_token:

SELECT verification_token FROM users WHERE email='myuser@mydomain';

@kmanojkumar
Copy link
Author

@denny64 AWS SES SMTP port was the issue. Port 465 worked for me, instead of the default 587.

I think it is something to with Nodemailer.

@Rupeshiya
Copy link
Contributor

Rupeshiya commented Jul 24, 2021

@hugomd @kmanojkumar I am also getting same issue with setting up locally.
Can you please tell me how can I fix that?
image

It is not able to send verification email

@hugomd
Copy link
Contributor

hugomd commented Jul 25, 2021

@hugomd @kmanojkumar I am also getting same issue with setting up locally.
Can you please tell me how can I fix that?
image

It is not able to send verification email

Looks like it may be trying to send mail via a mail host that doesn't exist. You should be able to try the query in my earlier comment:

SELECT verification_token FROM users WHERE email='myuser@mydomain';

Your issue looks related to #418 and #415.

If you absolutely need to send mail locally, you could try isolating the problem by connecting to the mail server via a separate client.

@Rupeshiya
Copy link
Contributor

Rupeshiya commented Jul 25, 2021

@hugomd @kmanojkumar I am also getting same issue with setting up locally.
Can you please tell me how can I fix that?
image
It is not able to send verification email

Looks like it may be trying to send mail via a mail host that doesn't exist. You should be able to try the query in my earlier comment:

SELECT verification_token FROM users WHERE email='myuser@mydomain';

Your issue looks related to #418 and #415.

If you absolutely need to send mail locally, you could try isolating the problem by connecting to the mail server via a separate client.

yes @hugomd I tried to verify using the route /verify/auth_token but that is giving invalid verification
Can you please tell me how can I setup email using my personal gmail then?

@hashlash
Copy link
Contributor

@Rupeshiya my token was giving 'invalid verification' error, but when I checked the database it's been verified (and now the user can login). Perhaps it was because the verification occurred twice?

Or, if anyone want to directly verify the user through database, I think you can use:

UPDATE users
SET verification_expires=NULL,
    verification_token='',
    verified=true
WHERE email='myuser@mydomain';

@hieptuanle
Copy link

@denny64 AWS SES SMTP port was the issue. Port 465 worked for me, instead of the default 587.

I think it is something to with Nodemailer.

Yes the doc in Nodemailer also state this about MAIL_SECURE environment variable:

secure – if true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false

Just want to make this super clear for everyone.

@NarHakobyan
Copy link

Hi everyone, I've opened PR which will help you to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants