Git Product home page Git Product logo

parse-server-mailgun-adapter-template's People

Contributors

alsoft-alex avatar bcomeau avatar davimacedo avatar drew-gross avatar nitrag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

parse-server-mailgun-adapter-template's Issues

%link% variable is rendered once only.

If %link% variable is used in more than one places, let's say one in a link button and one as plain text in a paragraph, it's rendered in the first place only. I have tried switching places and using other html attributes.

Use with environment variables

Hi ,
I noticed that currently this adapter can be used only with json configuration. I waned to know if it is possible to support also environment variables?

Thanks.

Multilingual emails

It could be useful to have localized email subject/body matching the user's communication preferences.

A column could be added to the User class to save some sort of localeIdentifier. Like used in the Installation class.

The localization could be done simply by using a subject/body for each supported language with a default one.

TypeError while HTML email sending is successful

When passwordResetBodyHTML is set, the option is used and the HTML email sent is well received but there is an error in the logs:

0|parse-se | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|parse-se | TypeError: Cannot read property 'catch' of undefined
0|parse-se |     at Promise (/home/parse/node_modules/parse-server-mailgun-adapter-template/index.js:118:11)
0|parse-se |     at Object.sendPasswordResetEmail (/home/parse/node_modules/parse-server-mailgun-adapter-template/index.js:103:14)
0|parse-se |     at /usr/lib/node_modules/parse-server/lib/Controllers/UserController.js:194:26
0|parse-se |     at process._tickDomainCallback (internal/process/next_tick.js:129:7)

It seems to be related to the catch closure:

return new Promise((resolve, reject) => {
	mail.build((mailBuildError, message) => {
	if(mailBuildError){
		return reject(mailBuildError);
	}
	var dataToSend = {
		to: getRecipient(options.user),
		message: message.toString('ascii')
	};
	mailgun.messages().sendMime(dataToSend, (err, body) => {
		if (err) {
			return reject(err);
		}
		resolve(body);
	});
	}).catch(err => {
		reject(err);
	});
});

Has anyone experienced the same thing?

Mailgun SDK Error

I'm setting up verification emails, and it seems like there is an error in the send call.

I'm sending a plaintext email, and this is the data object that is being built:

      var data = {
        from: {name: options.appName, address: mailgunOptions.fromAddress},
        to: options.user.get("email"),
        subject: fillVariables(mailgunOptions.verificationSubject, options),
        text: fillVariables(mailgunOptions.verificationBody, options)
      }

The error I'm receiving says Invalid parameter type. from must be of type: string. so it looks like it's balking at the name and address object in the from field and just wants the from email as a string. Have you seen this before?

Sent Mail unreadable due to mailgun charset

@bcomeau ,

I am using parse-server-mailgun-adapter-template instead of default email adopter so that I can change passwordreset mail subject and body as I want.
When I have set Japanese characters to subject and body, sent email has 'Content-Type:text/plain; charset="ascii"' header and body&subject are unreadable characters.

My index.js code is below.

var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
fileKey: process.env.FILE_KEY || '', // Add the file key to provide access to files already hosted on Parse
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
},
verifyUserEmails: true,
emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds)
preventLoginWithUnverifiedEmail: false, // defaults to false

publicServerURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: '日本語アプリ名',
// The email adapter
emailAdapter: {
module: 'parse-server-mailgun-adapter-template',
options: {
// The address that your emails come from
fromAddress: process.env.MG_FROM_ADDRESS || '[email protected]',
// Your domain from mailgun.com
domain: process.env.MG_DOMAIN || 'example.com',
// Your API key from mailgun.com
apiKey: process.env.MG_APIKEY || 'key-mykey',
verificationSubject: process.env.MG_VERIFY_EMAIL_SUBJECT || 'メールアドレスを確認してください -',
// Verification email body
verificationBody: process.env.MG_VERIFY_EMAIL_BODY || 'Hi %username%,\n\nYou are being asked to confirm the e-mail address %email% with %appname%\n\nClick here to confirm it:\n%link%',
// Password reset email subject
passwordResetSubject: process.env.MG_PASSRESET_SUBJECT || 'パスワードリセット',
// Password reset email body
passwordResetBody: process.env.MG_PASSRESET_BODY || 'Hi %username%,\n\nYou requested a password reset for %appname%.\n\nClick here to reset it:\n%link%',
}
},

I set environment property in AWS EB about "MG_APIKEY, MG_DOMAIN, MG_FROM_ADDRESS, MG_PASSRESET_BODY, MG_PASSRESET_SUBJECT, MG_VERIFY_EMAIL_BODY, MG_VERIFY_EMAIL_SUBJECT", those body and subject parameters are in Japanese characters.

When I user default parse-server-simple-mailgun-adapter, email has 'Content-Type:text/plain; charset="utf-8"' header and I could read email normally even it has Japanese character replaced with %appname%.

Is there any way to solve this problem for example like "encording" parameter should be written in options etc.

Thank you in advance.

Wont trigger

When the user reset password command is initiated the email will not be sent. I check the log files on the server, php, accesss, error and the logs on mailgun and nothing is available... Any suggestions?

Unhandled exception

Is anyone else seeing this in their logs?

(node:3922) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'catch' of undefined
    at Promise (/var/app/current/node_modules/parse-server-mailgun-adapter-template/index.js:60:11)
    at new Promise (<anonymous>)
    at Object.sendVerificationEmail (/var/app/current/node_modules/parse-server-mailgun-adapter-template/index.js:45:14)
    at getUserIfNeeded.then.user (/var/app/current/node_modules/parse-server/lib/Controllers/UserController.js:152:22)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
(node:3922) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 119)

link is wrong

Parse mailgun works well ut when I click the confirm link, it's always wrong, it doesn't work at all

Hitting error related to IncomingMessage in the libs folder.

Is this adapter still maintained ? im hitting this error

`/PROJECT_DIR/node_modules/parse-server/lib/ParseServer.js:261
throw err;
^

Error: Forbidden
at IncomingMessage. (/PROJECT_DIR/node_modules/parse-server-mailgun-adapter-template/node_modules/mailgun-js/lib/request.js:309:15)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
statusCode: 401
}
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.