mdoerk / seng513project

Course Project of SENG 513
http://pages.cpsc.ucalgary.ca/~sillito/seng-513/project.html
23 stars 21 forks source link

Alert via email when new comment(s) have been posted #246

Closed mmalinao closed 13 years ago

mmalinao commented 13 years ago

When a user has created an issue, they will be alerted via email when another user has commented (or like/disliked) the issue.

sabad66 commented 13 years ago

hey Matt, I'm working on an emailing library right now that you can use for this. It's ready to go, just waiting for the application config file feature to be puleld into the mainline since it will depend on it (for the email password). Here's the API for it that I'm going to put in the README:

Email Utilities

A library that can be used to send emails on behalf of the system. It is specifically set up for use with a gmail account. The application configuration file (config.js) should have the following settings defined in order for this to work: email_account: "someone@something.com" // civicconnect@gmail.com is set-up and ready to use email_password: "****" // If you don't know the password, email me at sabad66@hotmail.com to find out smtp_server_name: "smtp.gmail.com" // That is the smtp server (outgoing mail server) for gmail

Email Utilities API

Load the email utilities library: var emailUtil = require('emailUtil');

Notes

Please be careful not to commit your config.js file with the password in there.

Sometimes emails take a few seconds to send, so it's probably better NOT to render any page responses inside the callbacks. Instead, render the page outside the callback like this:

emailUtil.sendPlainTextEmailToUserId(999, 'Confirm Email', 'Please click the follwoing link to confirm your email.', function(error, success) {
    if (error)
        util.log('error sending the confirmation email');
    else if (!success)
        util.log('Email was not sent successfully');
    else
        util.log('Confirmation email sent successfully!');
});
response.render('confirmationSent.html');

Other things besides rendering response should probably still be inside the callback function.

mmalinao commented 13 years ago

Hey can you let me know once that has gone through? That will be a huge help for me to set up a couple a features I had in mind :)

On Thu, Mar 31, 2011 at 3:49 PM, sabad66 < reply@reply.github.com>wrote:

hey Matt, I'm working on an emailing library right now that you can use for this. It's ready to go, just waiting for the application config file feature to be puleld into the mainline since it will depend on it (for the email password). Here's the API for it that I'm going to put in the README:

Email Utilities

A library that can be used to send emails on behalf of the system. It is specifically set up for use with a gmail account. The application configuration file (config.js) should have the following settings defined in order for this to work: email_account: "someone@something.com" // civicconnect@gmail.com is set-up and ready to use email_password: "****" // If you don't know the password, email me at sabad66@hotmail.com to find out smtp_server_name: "smtp.gmail.com" // That is the smtp server (outgoing mail server) for gmail

Email Utilities API

Load the email utilities library: var emailUtil = require('emailUtil');

  • emailUtil.sendPlainTextEmailToUserId(userId, subject, body, function(error, success) {}) - Sends a plain text email to the given userId. The body parameter should be plain text (i.e. no html tags)
  • emailUtil.sendHTMLEmailToUserId(userId, subject, body, function(error, success) {}) - Sends an HTML formatted email to the given userId. The body parameter may contain html formatting (i.e body = 'hi friend!')
  • emailUtil.sendPlainTextEmailToAddress(toEmailAddress, subject, body, function(error, success) {}) - Sends a plain text email to the given email address. The body parameter should be plain text (i.e. no html tags)
  • emailUtil.sendHTMLEmailToAddress(toEmailAddress, subject, body, function(error, success) {}) - Sends an HTML formatted email to the given email address. The body parameter may contain html formatting (i.e body = 'hi friend!')

Notes

Please be careful not to commit your config.js file with the password in there.

Sometimes emails take a few seconds to send, so it's probably better NOT to render any page responses inside the callbacks. Instead, render the page outside the callback like this:

   emailUtil.sendPlainTextEmailToUserId(999, 'Confirm Email', 'Please

click the follwoing link to confirm your email.', function(error, success) { if (error) util.log('error sending the confirmation email'); else if (!success) util.log('Email was not sent successfully'); else util.log('Confirmation email sent successfully!'); }); response.render('confirmationSent.html');

Other things besides rendering response should probably still be inside the callback function.

Reply to this email directly or view it on GitHub: https://github.com/mdoerk/seng513project/issues/246#comment_943228

sabad66 commented 13 years ago

Yup, there will be a pull request within an hour or less.. I've tested it and its working, just have to run to walmart real quick lol. Just code it up using the below API, and it will work fine once it's officially pulled in.

-----Original Message----- From: QuickS1lver [mailto:reply@reply.github.com] Sent: March-31-11 10:20 PM To: sabad66@hotmail.com Subject: Re: [GitHub] Alert via email when new comment(s) have been posted [mdoerk/seng513project GH-246]

Hey can you let me know once that has gone through? That will be a huge help for me to set up a couple a features I had in mind :)

On Thu, Mar 31, 2011 at 3:49 PM, sabad66 < reply@reply.github.com>wrote:

hey Matt, I'm working on an emailing library right now that you can use for this. It's ready to go, just waiting for the application config file feature to be puleld into the mainline since it will depend on it (for the email password). Here's the API for it that I'm going to put in the README:

Email Utilities

A library that can be used to send emails on behalf of the system. It is specifically set up for use with a gmail account. The application configuration file (config.js) should have the following settings defined in order for this to work: email_account: "someone@something.com" // civicconnect@gmail.com is set-up and ready to use email_password: "****" // If you don't know the password, email me at sabad66@hotmail.com to find out smtp_server_name: "smtp.gmail.com" // That is the smtp server (outgoing mail server) for gmail

Email Utilities API

Load the email utilities library: var emailUtil = require('emailUtil');

  • emailUtil.sendPlainTextEmailToUserId(userId, subject, body, function(error, success) {}) - Sends a plain text email to the given userId. The body parameter should be plain text (i.e. no html tags)
  • emailUtil.sendHTMLEmailToUserId(userId, subject, body, function(error, success) {}) - Sends an HTML formatted email to the given userId. The body parameter may contain html formatting (i.e body = 'hi friend!')
  • emailUtil.sendPlainTextEmailToAddress(toEmailAddress, subject, body, function(error, success) {}) - Sends a plain text email to the given email address. The body parameter should be plain text (i.e. no html tags)
  • emailUtil.sendHTMLEmailToAddress(toEmailAddress, subject, body, function(error, success) {}) - Sends an HTML formatted email to the given email address. The body parameter may contain html formatting (i.e body = 'hi friend!')

Notes

Please be careful not to commit your config.js file with the password in there.

Sometimes emails take a few seconds to send, so it's probably better NOT to render any page responses inside the callbacks. Instead, render the page outside the callback like this:

   emailUtil.sendPlainTextEmailToUserId(999, 'Confirm Email', 'Please

click the follwoing link to confirm your email.', function(error, success) { if (error) util.log('error sending the confirmation email'); else if (!success) util.log('Email was not sent successfully'); else util.log('Confirmation email sent successfully!'); }); response.render('confirmationSent.html');

Other things besides rendering response should probably still be inside the callback function.

Reply to this email directly or view it on GitHub: https://github.com/mdoerk/seng513project/issues/246#comment_943228

Reply to this email directly or view it on GitHub: https://github.com/mdoerk/seng513project/issues/246#comment_944208

sabad66 commented 13 years ago

Pull request is in... Go ahead and review it if you want it pulled in.