Email is not working in Live only in Node.js - node.js

I'm using the node to send the email and it works fine in Local but when I upload on AWS instance it's not working.
To send the Email I'm using the Node Mailer which is very common so I'm not putting the whole code but I'm sharing the Link and the code is 100% the same.
I'm getting below Error in live only.
Note: I Enable the Google less secure app also.

seems like they ask you to follow link in smtp server negotiations response, and probably fill captcha.
I'm not sure for less secure app, but for me creating application password for access email on this page
https://myaccount.google.com/apppasswords
worked properly both with nodemailer and Claws email client

You can try this:
Enable less secure apps - https://www.google.com/settings/security/lesssecureapps
Disable Captcha temporarily so you can connect the new device/server - https://accounts.google.com/b/0/displayunlockcaptcha

Finally I found the solution that It was related to AWS server config issue.
In AWS, EC2 -> Security Group I open all TCP port and tried and it's working fine now.

Related

Error when setting up webhook with Ngrok/WhatsApp

I am trying to setup a WhatsApp bot using voiceflow, based on the tutorial found here. I've set this up before and everything has worked fine, but now I can't seem to configure the webhook.
The steps I'm performing are as follows:
Clone the repo here
Checked ngrok is installed (version 3.0.7), and its location (/usr/local/bin/ngrok)
Created a .env file at the root with the VERIFY_TOKEN, PORT, and WHATSAPP_TOKEN
Started the app from root with npm start
Started ngrok with ngrok http 8000 (the same port as specified in my .env)
Checked the resulting address works in the browser
According to the documentation, I then configure the webhook by adding "/webhook" to the end of the URL, and adding the same VERIFY_TOKEN as specified in my .env file. This, however, gives me the following error:
The callback URL or verify token couldn't be validated.
Please verify the provided information or try again later.
I've had a look around at similar questions here, but could not find what was wrong. I have also spoken to others who encountered similar issues over the last few weeks. This process was working up until recently (Nov 2022).
The error msg: The callback URL or verify token couldn't be validated. Please verify the provided information or try again later. usually means you are not returning a 200 response to the webhook origin. I would make sure your code is returning a 200 to whatsapp.
As an alternative, try to set the webhook on glitch as explained here:
https://developers.facebook.com/docs/whatsapp/sample-app-endpoints#cloud-api-sample-app-endpoint
so that you can check if your meta account is valid.
From what I have found it seems that feature is now behind a paywall. It worked fine a few months ago on the free tier of ngrok. So you will need to upgrade your ngrok subscription for WhatsApp to start validating. You can read about it here. Try using Cloudflare tunnel.

nodemailer to send mail from portfolio site

I have successfully created a Node.js server with Express and also installed nodemailer to send the data from the 'Contact Me' form from my front-end React app. I have uploaded this on Heroku.
I have a question though - since this endpoint is set up on this public domain, in theory, someone could inspect my source code, find the URL, and build a script out to make a ton of POST requests with random data to blow up my inbox.
Is there anything that can be done to stop this sort of behavior? Where would I even start to research into this?
I think Captcha could help you.
CORS is what you're looking for. I recommend reading up a lot more on it since it will pay off greatly for your web development journey! https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
The short answer is that you must set a Access-Control-Allow-Origin: <yoursite>.com header in CORS policy for your Node.js app (install it from npm), which will turn down any requests made by a 3rd party actor who inspects the form destination address.

Azure Bot Service not working in Web Chat behind proxy

I have created a basic C# bot in Azure and have been doing some tests with it. I am able to debug locally and test that the bot works and responds normally, However, Web Chat does not seem to work (either the "test in web chat" within Azure or the embed code provided under "Channels" menu. The bot does not respond and the following can be seen in the browser's console:
botchat.js:20 WebSocket connection to 'wss://webchat.botframework.com/v3/directline/conversations/b00803da186843c08e057a03f1af26d3/stream?watermark=5&t=PdrKaTBDGps.dAA.YgAwADAAOAAwADMAZABhADEAOAA2ADgANAAzAGMAMAA4AGUAMAA1ADcAYQAwADMAZgAxAGEAZgAyADYAZAAzAA.PWqO6rz50wE.O0xFG-RkTZ0.306EPN7-0X_MGGfBUujpWoKN8Xm942hqpn_BVxbRe_M'
failed: Error during WebSocket handshake: Unexpected response code: 400
(anonymous) # botchat.js:20
This happens with any chat bot created in Azure even without any code changes but only when in my company environment, which is behind a proxy. I am almost certain that this is somehow the cause of the problem, but I have no clue why nor how I might approach the proxy team to report the problem nor what I may need to ask them to unblock.
The Question: Am I right to assume that this is a proxy problem or should I investigate something else and, if this is indeed a proxy issue, what do I need to do/ask to unblock to solve it?
Any help is highly appreciated!
This is definitely a Proxy issue, You can talk to your admin team and get these links removed from their firewall settings so you can get access. We do get this issue's in our company we do the same as i have suggested.\
Happy coding!!!

Slackbox - the requested URL could not be retrieved - access denied

I have slackbox running locally, have created a Spotify dev application and have successfully authenticated slackbox. It says I am logged in at http://localhost:5000/. All of my variables have been set, including the slack token, in an .env file via dotenv.
All seems well there.
On the slack side, I have created a slash command mapped to /spotify that POSTs to http://localhost:5000/store. The slash command shows up in my command description list when typing.
When I attempt to use it though, I get an access denied message in chat, I'm assuming due to cross-domain issues:
ERROR: The requested URL could not be retrieved Access Denied.
According to their docs - https://github.com/benchmarkstudios/slackbox - running this locally should work. I also run a Hubot bot locally and it integrates fine with the same slack room.
Any help is appreciated!
https://sprint.ly/blog/5-steps-to-a-slack-integration/
Slack’s outgoing slash command requests need to be sent to a public facing url, which is a problem if we want to receive these messages to our local development server.
How do we solve this?
One way is with the use of a secure tunnel which acts as a public HTTPS URL for our local development server. Problem solved!
Who provides this service?
ForwardHQ provide the best user experience, including a browser extension for setting up a local tunnel in one click. They have a free 7 day trial.
My preferred option is ngrok. It’s free for one concurrent tunnel client, with no time restriction. Woop! Its a little harder to use but it does the job.

Mailing functionality using node.js's nodemailer fails in openshift

I have an issue with nodemailer support in openshift. I created a simple node.js application that sends a mail using nodemailer, following the hello world example given in https://github.com/andris9/Nodemailer
The mail is sent from a gmail id to two other gmail ids. This functionality is invoked while rendering the home page of my application. It worked well when the node.js application was run locally. I created a node js application in openshift and tested the application locally. I worked well. But on deploying the app to open shift, the mailing functionality failed, though the home page was rendered properly.
Is this mailing feature supported in openshift? Or am I missing something, like some extra configuration that is required in openshift for enabling this mailing support?
Thanks.
Hmm, this should work ... can you try changing the port # you are using -- say try 587 with TLS in the
wellknown.js configuration. See if that works.
The other thing to check is that your email provider allows authenticated connections from Amazon AWS EC2 hosts.
HTH

Resources