arithmetric / aws-lambda-ses-forwarder

Serverless email forwarding using AWS Lambda and SES
MIT License
1.7k stars 450 forks source link

Connot read property 'log' of undefined #139

Open mattr5341989 opened 1 year ago

mattr5341989 commented 1 year ago

I've seen 4 other issues like this but none of them seem to have an answer as to why.. or at least not in my situation. Here is my lambda function. Please help.

`"use strict"; var AWS = require('aws-sdk');

console.log("AWS Lambda SES Forwarder // @arithmetric // Version 5.0.0");

// Configure the S3 bucket and key prefix for stored raw emails, and the // mapping of email addresses to forward from and to. // // Expected keys/values: // // - fromEmail: Forwarded emails will come from this verified address // // - subjectPrefix: Forwarded emails subject will contain this prefix // // - emailBucket: S3 bucket name where SES stores emails. // // - emailKeyPrefix: S3 key name prefix where SES stores email. Include the // trailing slash. // // - allowPlusSign: Enables support for plus sign suffixes on email addresses. // If set to true, the username/mailbox part of an email address is parsed // to remove anything after a plus sign. For example, an email sent to // example+test@example.com would be treated as if it was sent to // example@example.com. // // - forwardMapping: Object where the key is the lowercase email address from // which to forward and the value is an array of email addresses to which to // send the message. // // To match all email addresses on a domain, use a key without the name part // of an email address before the "at" symbol (i.e. @example.com). // // To match a mailbox name on all domains, use a key without the "at" symbol // and domain part of an email address (i.e. info). // // To match all email addresses matching no other mapping, use "@" as a key. var defaultConfig = { fromEmail: "sales@inboundEmail.com", subjectPrefix: "", emailBucket: "cc-app-5058", emailKeyPrefix: "", allowPlusSign: true, forwardMapping: { "@protonmail.com" : [ "forwardEmail@protonmail.com"] } };

/**

/**

/**

/**

/**

/**

Promise.series = function(promises, initValue) { return promises.reduce(function(chain, promise) { if (typeof promise !== 'function') { return Promise.reject(new Error("Error: Invalid promise item: " + promise)); } return chain.then(promise); }, Promise.resolve(initValue)); }; `

fardadja commented 1 year ago

What is you whole Error log?

First thing I would check if I were you is the forwardMapping object. You currently have: forwardMapping: { "@protonmail.com" : [ "[forwardEmail@protonmail.com](mailto:forwardEmail@protonmail.com)"] } Meaning you have a catch-all for [anything]@protonmail.com and then forwarding them to forwardEmail@protonmail.com, which sounds like a loop to me. But anyway, make sure you have that set correctly.

So check that out, and also make sure you have verified your domain name (e.g. protonmail.com in your example). Otherwise, you should use a verified emailed identity, if you can't verify your domain. If you don't know what I'm talking about, see here: https://docs.aws.amazon.com/ses/latest/dg/verify-addresses-and-domains.html

Hope that helps. If not, let us know.