Mailing for Thinkup – Hacking a Solution without using Sendmail

I’ve been meaning to try Thinkup for a long time now, and finally got around to trying it out.

I also decided this was also a good time to try a RaspberryPi and so the system I ended up running it on was not as complete as a normal linux server, or commercially provided host.

After installing dependencies, I quickly got stymied when I did not get a confirmation email.

Apparently this isn’t unique:

http://thinkupapp.com/docs/troubleshoot/common/emaildisabled.html

Also, their guidance is that; “We strongly recommend running ThinkUp on a web server which can send email.”

Using GMail as my SMTP server seemed the obvious choice, but that was before I learned that PHP’s mail() function does not support authentication in any way.

Apparently the most popular solution I found on Google was to use PHPMailer and this required some hacking that I wanted to document here.

I’m not sure if all of these steps are necessary, but it worked for me (TM):

  1. sudo vi /etc/php5/cgi/php.ini
    Add the line extension=php_openssl.so
  2. Download PHPMailer and extract it into your thinkup _lib directory [for me this was /usr/share/nginx/www/thinkup/_lib]
  3. Hack /usr/share/nginx/www/thinkup/_lib/class.Mailer
    • Add the following to the beginning of the file [right after "<?php"]: "ini_set("include_path", ".:./PHPMailer_v5.1/");
      require("PHPMailer_v5.1/class.phpmailer.php");
      "
    • Find "} else { mail($to, $subject, $message, $mail_header);" and comment it out [with //]
    • then add:
      /** KLUDGE ADDED - START **/
      $mail = new PHPMailer();
      $mail->IsSMTP();
      // $mail->SMTPDebug = 2;
      $mail->SMTPAuth = true;
      $mail->SMTPSecure = "tls";
      $mail->Host = 'smtp.gmail.com';
      $mail->Port = 587;
      $mail->Username = "YOURNAME@gmail.com";
      $mail->Password = "YOURPASSWORD";
      $mail->SetFrom("YOURNAME@gmail.com", "thingkup_notifications");
      $mail->AddAddress($to);
      $mail->Subject = $subject;
      $mail->Body = $message;
      $mail->WordWrap = 50;
      if(!$mail->Send()) {
      echo 'Message was not sent.';
      echo 'Mailer error: ' . $mail->ErrorInfo;
      }
      else {
      echo 'Message has been sent.';
      }
      /** KLUDGE ADDED - END **/

I hope that helps someone, I can't say it's extensively tested (I wanted to blog it all before I forgot) but it worked in my example test script, which has to be close enough, right!

About jay

I'm trying to build something interactive where I can learn from others and hopefully share useful knowledge too. thecapacity@gmail.com
This entry was posted in code, opensource. Bookmark the permalink.

17 Responses to Mailing for Thinkup – Hacking a Solution without using Sendmail

  1. Thanks for any other great article. Where else could anyone get that type of information in such an ideal method of writing? I have a presentation subsequent week, and I’m at the search for such information.

  2. Wow, fantastic weblog structure! How lengthy have you been running a blog for? you made blogging glance easy. The total glance of your website is great, as neatly as the content!

  3. Great put up, very informative. I’m wondering why the other specialists of this sector do not realize this. You must continue your writing. I’m confident, you have a great readers’ base already!|What’s Going down i am new to this, I stumbled upon this I’ve discovered It absolutely helpful and it has helped me out loads. I hope to give a contribution & help different customers like its helped me. Great job.

  4. Hey There. I discovered your blog using msn. This is a really smartly written article. I will be sure to bookmark it and return to learn extra of your helpful information. Thanks for the post. I’ll definitely comeback.

  5. Gadgets says:

    Attractive component of content. I simply stumbled upon your blog and in accession capital to assert that I get actually loved account your weblog posts. Anyway I’ll be subscribing for your augment or even I success you get right of entry to persistently rapidly.

  6. Sportingbet says:

    Hello my friend! I wish to say that this article is amazing, great written and come with approximately all significant infos. I’d like to see extra posts like this .

  7. there s some good points here

  8. I have been surfing online more than 3 hours these days, but I never found any interesting article like yours. It’s lovely worth enough for me. Personally, if all webmasters and bloggers made just right content material as you probably did, the internet will likely be a lot more helpful than ever before.

  9. one two says:

    haha nice, real nice

  10. Hello there, You’ve done a great job. I’ll definitely digg it and individually recommend to my friends. I am sure they’ll be benefited from this site.

  11. Hello there, You have done an excellent job. I will definitely digg it and in my view suggest to my friends. I am sure they’ll be benefited from this website.

  12. hi!,I really like your writing very a lot! share we keep up a correspondence more approximately your article on AOL? I need a specialist in this house to unravel my problem. May be that’s you! Having a look forward to peer you.

  13. Darius Horr says:

    Dear Webmaster! I just discovered your Blog and all the interesting and useful Information that you provide but I also found out that your Blog posts are not really optimized for the corresponding keywords and topics you are writing about. If you are interested you could try one of these WordPress SEO Plugins [http://bit.ly/15gaGx8] that automatically makes small alterations to your Posts to gain visibility in the Search Engines like Google, which will provide you with more organic and free visitors and therefore increases your potential revenue and exposure. Take a look and if you encounter any problems or questions send me an email. Have a nice day!

  14. Fantastic beat ! I would like to apprentice whilst you amend your website, how can i subscribe for a weblog web site? The account aided me a acceptable deal. I have been a little bit acquainted of this your broadcast provided bright transparent idea

Comments are closed.