-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
Hey @ilanbiala, It needs some work to get it done:
Can you work out the fixes and let's try again? |
So does this only work if we have a mailer set up? Is there a way for us to do this without having to go through email, i.e. just do it for the user the next time they log in? Thanks @ilanbiala for taking a crack at this. |
@wesleyfsmith you can definitely add a flag to your model and set it to false and have the user reset and upon reset change it to true. That's a possible solution, too. |
@lirantal I added a scripts folder, so now ../ goes to /, and then config/lib/mongoose is the mongoose connection handler file. I believe the schemas are properly loaded now as well. |
@lirantal Are there any other changes that need to be made? |
@lirantal LGTY? |
I'm still unable to run it on the 0.4.0 branch.
Did you try running it? |
@lirantal just fixed the issue and it should be working now, let me know if you run into issues with the new script. |
@ilanbiala did you remember to push the change? I'm getting the exact same error :) |
Yep pushed and re based. It may be easier for you to just copy the raw or clone my fork branch. |
@ilanbiala tried that too, still same error. it also complains on:
|
Sorry, forgot the |
@ilanbiala great, it's running now, except a slight object issue - I noted in the code comments. |
console.log('Error: ', err); | ||
console.log('Could not send email for ', user.displayName); | ||
} else { | ||
console.log('Sent reset password email for ', user.displayName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notice that there's no user object here, only users.
@lirantal fixed code with your comments, let me know if anything else is missing. Also, should we have tests for this? |
Looks good @ilanbiala I'm merging. Don't think we need to add tests for the script itself. |
I'm having an issue with this script. I'm running just as @lirantal commented above.. from my top level meanjs folder. I've verified that my mailer config settings are getting set for the transporter correctly. The script doesn't produce an error. It runs, and responds with "Sent all emails". However, no emails are sent; and it doesn't seem like the callback is getting executed. My other emails, from my application, are being sent fine. For instance, when requesting a password reset. The only difference I notice with the forgot password, and this script, is that the callback is defined with err, info; the info param is not present in the password server controller. Anyone else having issues with this? I'm using Amazon's SES. |
@ilanbiala can you look into it now that we're on 0.4.0 branch? maybe some things changed with the merge from master? |
@mleanos did you get any errors/logs before "Sent all emails". If you didn't, that seems like there are no users in the database. Can you check that? |
@ilanbiala I logged events, and the user data to the console. The users were present, along with their emails. I verified that the transporter was getting populated with the correct config settings as well. I didn't get any errors. The script correctly iterated through the users. However, it appears that the script stopped, or had an issue, with the sendMail line. All the other emails from the application are sending just fine; using the same config settings for the mailer. I'll take a look at it again today, as I just merged the most recent changes. I did have some issues with merging the most recent changes from yesterday. Mostly, with dependencies. It could have been something funky going on with those issues. |
@ilanbiala I've verified that I'm still having this issue, after merging the most recent commits from 0.4.0. Is it working for you? |
@mleanos can you log the sendMail and see what the message says? |
@ilanbiala I logged the sendMail, and it output undefined for each iteration of my user's. |
@mleanos is it possible that sendMail isn't defined in the configuration for the specific environment you are running this script with? would be good if you can check that angle. |
@lirantal I've verified that my configuration settings are properly set to the transporter, with the createTransport method of nodemailer. I compared the transporter's configuration from this script, and from my applications password forgot server controller method. Both instances had the same settings. My SES config was set properly. It's interesting to me that the sendMail method doesn't seem to be executing at all. The callback never gets fired. No errors, or any indication that anything went wrong with the sendMail. I assume, this is working for you, in the most up to date 0.4.0 branch? |
@lirantal Just to be sure. Can you clarify what you mean by the sendMail configuration being set in my environment? If the sendMail wasn't configured correctly, due to the environment the script is running in, wouldn't the transporter settings not get set properly? Or is there something else that I'm not understanding? |
@mleanos I was referring to the configuration here https://github.com/meanjs/mean/blob/0.4.0/config/env/development.js#L54-L61 - if it is set or not for your environment. If it's missing then obviously no emails will be sent out. |
@lirantal Yes, those settings were definitely set. I was able to verify this by writing the settings to the console. Everything looked perfect. The email object had the correct properties as well. |
@mleanos is the API key still in Mandrill or SendGrid or whatever service you are using, because I can't think of a reason for the sendMail not to log even.. |
Yes, it is. I'm using Amazon's SES. Using the same config settings, the sendMail works through my app. I don't have to run the script with any additional parameters to determine what ENV config should be used, right? I'll look into any other possible reasons for this to fail, sometime today. |
@lirantal @ilanbiala This has been resolved with #755 . This can be closed. |
I also added a scripts/ folder on 0.4.0, because we are missing one.