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

Send single mail #327

Closed
wants to merge 2 commits into from
Closed

Conversation

Puigcerber
Copy link

Hi @thinkingserious! I've found some time to start working on #312 but before keep going I want your opinion because I wiped out the mail helper to start fresh with a class that simplifies the API.

There was only two tests for the mail helper and with these changes the first one with the minimum to send a single mail pass. So if you consider this is the way to go I can work on the Mail class to pass the second test.

@thinkingserious
Copy link
Contributor

@Puigcerber,

It looks like you are heading in the right direction :)

  • Could you please describe how you envision the final call signature will look like? It would be great to get some feedback from the community on that.
  • Could you please sign our CLA, so we will be able to merge your changes?

Thanks!

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: cla needed status: work in progress Twilio or the community is in the process of implementing labels Oct 25, 2016
this.setReplyTo = function(reply_to) {
this.reply_to = reply_to;
};
Mail.prototype.addFromEmail = function (email) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, I think it would be good to stick with the previous convention of setX method signature for properties that are not arrays, and addX for arrays.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also, Email in the method name might be redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thinkingserious I just realized that my suggestions are contrary to what you suggested in #312. 😛

Is that method signature of addFromEmail in line with what the other libraries are using?

Copy link
Author

@Puigcerber Puigcerber Oct 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @heitortsergent! I thought about it but followed the suggestions of @thinkingserious. Although I agree with you that we should use setX for the from email, subject, etc. This was just a proof of concept. 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on the setX and addX

+1 on addFrom instead of addFromEmail

Thanks!

@Puigcerber
Copy link
Author

I've signed and sent the CLA @thinkingserious and hope to find some time this weekend to keep working on the refactor.

@Puigcerber
Copy link
Author

Hi @thinkingserious @heitortsergent! I've finalized the refactor to pass the second test. Let me know what do you guys think.

@Puigcerber Puigcerber changed the title [WIP] Send single mail Send single mail Oct 31, 2016
@heitortsergent
Copy link
Contributor

@Puigcerber nice work! 💥

I need a little bit more time to go through all the changes, but it looks good to me. One quick question, did you have any specific reason for moving the functions to use prototype?

@heitortsergent
Copy link
Contributor

@thinkingserious thinking about email best practices and the example you posted on #312, should we add an abstraction to addTo and the other methods that take emails so users don't have to pass in a name? For example:

addTo("example@email.com")
addTo("example@email.com", "Example Name")

Are both valid options?

@Puigcerber
Copy link
Author

Hi @heitortsergent! As I wiped out the previous code and started fresh, I tend to favor prototype methods over constructor methods. If we were to send multiple emails creating instances of the Mail object, memory consumption should be lower with the prototype shared among all the instances.

For the other question I tried to be as flexible as possible, so the following will work:

mail.addTo('example@email.com');
mail.addTo('example@email.com', 'Example Name');
mail.addTo({ email: 'example@email.com', name: 'Example Name'});

@Puigcerber
Copy link
Author

Hey! What's the status on this @thinkingserious?

@thinkingserious
Copy link
Contributor

Hi @Puigcerber,

Thanks for checking in! This PR is currently #21 in our backlog.

It can rise faster in our queue if others will +1 this PR.

@SendGridDX
Copy link
Collaborator

Hello @Puigcerber,

This issue has finally made it to the top of my queue.

Before I proceed, I'd like to get feedback from @adamreisnz, as he has offered to help us refactor our mail helper based on his repo: https://github.com/adamreisnz/sendgrid-mailer

With Best Regards,

Elmer

@adamreisnz
Copy link
Contributor

@SendGridDX @thinkingserious

And working on the refactoring has nearly reached the top of my queue as well!
It's time, I will get on it in the next few days! :D

@SendGridDX
Copy link
Collaborator

Hello Everyone,

I thought you might be interested in the re-design on the SendGrid Node.js Mail Helper: #378

Your feedback would be greatly appreciated!

With Best Regards,

Elmer

@thinkingserious
Copy link
Contributor

This PR is moved to here: #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: work in progress Twilio or the community is in the process of implementing type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants