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

Only able to send mail with email address on config.js #3

Open
JulDes opened this issue Jan 16, 2017 · 7 comments
Open

Only able to send mail with email address on config.js #3

JulDes opened this issue Jan 16, 2017 · 7 comments

Comments

@JulDes
Copy link

JulDes commented Jan 16, 2017

Hi,

I implemented your configuration but I have issue. I would like to launch automatic notification with value of Input Parameters to the test event and not parameters on the Config.js file .

With config.js :

var config = {
"templateBucket" : "JudesBucket",
"templateKey" : "Templates/Template.html",
"fromAddress": "[email protected]",
"targetAddress" : "[email protected]"
}
module.exports = config

With test event parameters input:
{
"name": "JuDes notification",
"email": "[email protected]"
"message": " test message"
}

Template.html :

Email: {{email}}
Name: {{name}}

{{message}}

On the Lambda Success message, I receive the success notification " email sent to [email protected]" . It will be correct if It was the case .... but it is not send for this address but for the targetAddress "[email protected]" on the config.js file.

I`m not able to comment targetAddress else i obtained error with requiere parameters.

Are you able to help me please,

Thanks by advance

@dergroncki
Copy link

dergroncki commented Jan 17, 2017

I am not sure if I understand your question but have you tried this:

           var params = {
                Destination: {
                    ToAddresses: [
                        //config.targetAddress
                        event.email
                    ]
                },

@JulDes
Copy link
Author

JulDes commented Jan 17, 2017

Hi Mickael, Thanks. you for your response. 👍

I moved email address as static environment variable on lambda and change the code to obtain the value by process.env.email to read the key-value "email" "[email protected]" .

Now, I search how it is possible to give parameters to the templatebody with the field value {email} to read the process.env,email variable

In index file :
var params = {
[...]
Message: {
Body: {
Html: {
Data: " process.env.email",
Charset: 'UTF-8'
}
},

@abrantes01
Copy link

Add event.body.email = process.env.email before var message = mark.up(templateBody, event); should work I think.

@prashantgijare
Copy link

Does anyone have any documentation of steps to follow to make this work? I've couple of static sites and want to make this work desperately.

Thanks a bunch in advance.

~P

@mwhouser
Copy link
Contributor

@prashantgijare There are step-by-step instructions on setting this up on the main README.md file.

@camposfyi
Copy link

@prashantgijare - do you still need this? I finally got it to work end to end. My static website talks to my Gateway API which calls the lambda function to send the email. I also did some nice refactoring for the lambda code. I could put something together if you still need it.

@prashantgijare
Copy link

prashantgijare commented Dec 14, 2017 via email

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

6 participants