I just moved an app from Parse.com to Parse-Server.
It has users and I have an issue to send password-reset mails.
I am getting this message:
I read on the net that I need to change index.js.
But I have no index.js at this point.
So what do I need to do to make the password-reset mails work?
I already have an account on MailGun, which is needed as far as I have read, to solve this issue.
in order to support Password reset you need to define an email adapter inside your index.js file.
index.js file is located under the root folder of your parse-server project. the index.js is the file where ParseServer is being initialized.
The email adapters which are currently supported by parse-server are sendgrid and mailgun
Adding email adapter is pretty simple:
Install the relevant email adapter module. Enter npm install {email_module_name} --save in your parse-server project folder
Open index.js file and go to where ParseServer is being initalized and add the property verifyUserEmails: true
Add emailAdapter also the where ParseServer is being initialized
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse#example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
Related
So I'm trying to make my own inbox for emails using the followin packag beyondcode/laravel-mailbox
I installed the package on a blank project, in order to test it out.
I can send emails with the sendgrid API, so that's not a problem at all.
Now, I have some environment variables set;
MAILBOX_DRIVER=sendgrid
MAILBOX_HTTP_USERNAME=laravel-mailbox
MAILBOX_HTTP_PASSWORD=secret
The config just the same as given in the package.
In my AppServiceProvider, I have in the boot the following:
Mailbox::catchAll(static function(InboundEmail $email) {
// Handle the incoming email
Log::info('#-------------------------------------------------------------------------------------------#');
Log::info($email);
Log::info('#-------------------------------------------------------------------------------------------#');
});
But when I take a look in the logs, when I send an email to whatever#rallypodium.be, nothing hapens...
This is my DNS configuration:
And here is the inbound parse config on the sendgrid side:
What am I missing or doing wrong here? I looked at my access logs and not even a request is being made to the server from sendgrid...
So How can I make sure I can receive messages to whatever#mydomain.com?
Your DNS should also have a few CNAME records so that you can verify your domain with SendGrid.
I have installed Parse Server directly from Heroku and mLab button and then Deploy to Heroku Button.
This is working fine, but now I need to set up email verification. I have installed Mailgun and Mailgun Email Verification addons directly from Heroku. Under Config vars the correct keys are all there, but I get the error
An appName, publicServerURL, and emailAdapter are required for
password reset and email verification functionality. (Code: 1,
Version: 1.17.2)
I was under the impression that when installing addons directly from Heroku, the settings was deployed automatically. Do I need to configure anything else after installing?
That message isn't from Mailgun; it's from the parse server itself.
You'll have to either customize the code or configure it properly. I don't think the example code gives you a way to configure appName, publicServerUrl, or emailAdapter from the environment so you'll probably have to deploy a customized instance that sets those variables. This example looks helpful.
The steps that I have already done are as follows:
1)I've set up my EC2 instance already.
2) I've linked it up to amazon CodeDeploy
3) I've created an s3 bucket that will hold my cloud code when I push it to my instance.
4) I've created a folder that will contain my cloud code.
5) I've initialised npm within it and created an index.js file (it is a sublime text file actually - not sure if this is correct or not?)
6) I've set things up from the command line that index.js is the main entry point.
7) I have put the following email adapter code within it:
var server = ParseServer({
// Enable email verification
verifyUserEmails: true,
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'etc',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'etc',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse#example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});
8) I've set up an account with mailgun its asking me for a domain to send the emails from? I'm not sure what this is?
My main question is regarding the code i posted above. Is this enough to put into index.js to create an email adapter? And is uploading a sublime text file ok? How can the cloud know what "ParseServer" class is without importing libraries? - Do i have to add anymore code to index.js?
Additionally what else do I need in the cloud code package besides the index.js file? This has been such an obscure topic and there seems to be no clear guides online as to how to upload functional cloud code to amazon EC2 instances.
Any help appreciated, cheers.
Part of your steps are correct but you must also modify the form and the domain. Your domain (to your question) must be taken from your mailgun account. You must add some steps in order to setup your domain with your DNS provider (e.g. goDaddy etc.) If you don't want to use you can try to use the default sandbox domain that has been provided to you by mail-gun but it's better to use your own domain. In the from field you need to put some email address so users that will receive the email will see from which email this message sent to them. usually what I love to put is donotreplay# ( is your domain of course)
In my project, this is how I configure it (and it works):
"verifyUserEmails": true,
"emailAdapter": {
"module": "parse-server-simple-mailgun-adapter",
"options": {
"fromAddress": "donotreply#*******.com",
"domain": "mail.*******.com",
"apiKey": "<API_KEY_TAKEN_FROM_MAILGUN>"
}
},
Your list of domain in mail-gun can be found in here: https://app.mailgun.com/app/domains (login is required of course)
in here: https://documentation.mailgun.com/en/latest/user_manual.html#verifying-your-domain you can read how to verify your domain
Hope it helps.
I am looking for a good guide (or tutorial) on setting up mailgun to work on parse-server hosted on heroku.
Having trouble with some iOS app of mine not working.
I would like to review the process of setting up mailgun, following best practices and up to date documentations.
I found it to be fairly straightforward with plenty of resources available by googling parse-server and mailgun. If you don't need templatized emails then you can just add mailgun to your package.json and configure your mailgun adaptor in your index.js file like this:
new ParseServer({
databaseURI: xxx,
appId: xxx,
...
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
fromAddress: 'donotreply#yourdomain.com',
domain: process.env.MAILGUN_DOMAIN,
apiKey: process.env.MAILGUN_API_KEY,
}
}
see also: https://stackoverflow.com/a/37757222/4228969
i am running my migrated app on Heroku Parse-Server. When i try to send a password reset email from my app using 'requestPasswordResetInBackground' i get the following error:
"An appName, publicServerURL, and emailAdapter are required for password reset functionality.".
It used to work fine on Parse.com.
I’ve read about initiatives for implementing this missing functionality. Does anybody know if such an implementation is already available or will be soon, and if so how to configure it?
Thanks!
You need to go to mailgun.com and register an account. Then create a new domain in mailgun. You will get an api key for this domain.
Then you need to read through the readme for parse migration
https://github.com/ParsePlatform/parse-server/blob/master/README.md. There is example for mailgun. It is in the Parse Server so you don't need to install any extra template or require something at the index.js.
Add the following code in your index.js. It should be after your server initialization
var server = ParseServer({
//... your other configurations
// here the configuration for email begins
verifyUserEmails: true, //depends on your needs, you can set it to false
emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds)
preventLoginWithUnverifiedEmail: false, // defaults to false
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse#example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
After you change the updated index.js in your Parse server, you will be able to get email from mailgun. It could take some minutes to get the email.
Then you also need to implement the email resetting html pages on your own server. I haven't found a good tutorial yet.
If you installed the Parse server directly by Heroku, you will have server.js instead of index.js, you can find it in this directory: /opt/bitnami/apps/parse/htdocs/ and do all the changes in this file and restart the server