Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Home-Made Twitter and Gmail Notifications with PHP and Arduino
Jan 16, 2017 @ 16:48:54

On the SitePoint PHP blog Christopher Pitt is back with another tutorial showing you yet another "odd" use of PHP. In this latest post he shows you how to integrate PHP and an Arduino to relay Twitter and Gmail notifications.

I am a little obsessed with Twitter. It’s how I communicate with most of the developers I’m not fortunate to live in the same city as. I’m a little less obsessed with IoT projects, but then it’s harder to find the time to work on them than it is to check Twitter.

Unless I can do both at the same time.

Ever since the IoT week, I’ve been meaning to work on a project that will let me know when someone wants to speak to me. Something that looks cool, and is at the same time non-invasive. This is what I’ve come up with...

He connects the Arduino with a RBG LED and a a proximity sensor to a PHP script that will change the LED color based on the notification type. The sensor would allow some "hand waving" to dismiss the notification as "read". He then starts in on the hardware side of things including some illustrations of the Arduino board and how things connect. With that simple setup in place he moves over to the software side, creating a Notifier service interface and using the "endroid/twitter" package to connect over to Twitter. He then walks through the creation of the Gmail and Twitter applications, grabbing the related OAuth credentials and dropping them into the script's configuration file. He builds out notifier classes for each service and hooks it into the Arduino with the Firmata and Carica libraries. Finally he hooks it all together with a bit of SPLQueue functionality to loop and listen for new alerts to relay to the Ardunio.

tagged: arduino twitter gmail notifications tutorial proximity sensor led

Link: https://www.sitepoint.com/home-made-twitter-and-gmail-notifications-with-php-and-arduino/

Sameer Borate:
Downloading Gmail attachments in PHP – an update
Jul 29, 2014 @ 14:37:40

Sameer Borate has posted an update to a previous post of his about downloading attachments in PHP. In this new post he updates the script to remove any other dependencies other than the IMAP PHP extension.

As mentioned in the earlier post, automatically extracting attachments from Gmail can be important for reasons where you need to process the attached files periodically with a CRON job or need to process the files programmatically. Also it can be useful for automatically archiving important attachments. [The code in this post] is a simple proof-of-concept plain PHP code, devoid of any object-oriented features that extracts attachments from your Gmail account.

The example code makes a request to the Gmail IMAP servers with the given username and password, grabs the first set of emails, parses their attachments to pull them down to the local host. He also includes some searching capability to locate ones only matching certain criteria. A list of the allowed search keywords is also included. He finishes the post with a look at using READONLY mode and fetching the email headers.

tagged: attachment download gmail tutorial search

Link: http://www.codediesel.com/php/downloading-gmail-attachments-in-php-an-update/

NetTuts.com:
Sending Emails With Laravel 4 & Gmail
Dec 18, 2013 @ 17:57:25

NetTuts.com has posted a new tutorial today showing you how to use Laravel 4 and Gmail together to send emails from your application. It uses Laravel's own mail functionality, so there's no additional libraries to download.

Sending emails is crucial for any web application. Usually, an email is sent to notify the user of some kind of activity that has taken place on the site, for example, such as when updates have been made or when new friends have been found. In this short tutorial, I’ll show you how to send emails with Gmail quickly from within a Laravel sample application by extending the functionality that we built in my last tutorial, Authentication With Laravel 4.

They show you how to set up the mail configuration to correctly point to the Gmail STMP servers using your own Gmail username/password (or one you've set up for the application). Some sample code is included showing how to send an email once the user has registered. Also included is an example of using Laravel's own templating to build the contents of the email.

tagged: send email tutorial gmail laravel template

Link: http://net.tutsplus.com/tutorials/php/sending-emails-with-laravel-4-gmail/

Script-Tutorials.com:
Google API - Get contact list
Jul 26, 2012 @ 14:26:27

In this new tutorial on the Script-Tutorials.com site, they show you how to use the Google API (and OAuth) to access contacts information from your Gmail account.

In our new tutorial I am going to tell you about inviting friends. I think that this is the most important part for every website, a key to success. Today I will show you how to create simple and effective Gmail contact importer using OAuth authorization and API. Also, I will tell about obtaining Google API access too.

Screenshots show you how to get to the access token information you'll need to connect and the full code is included to help you get authenticated and pull down the contacts list to display in the page's HTML output.

tagged: tutorial google gmail api oauth key contacts

Link:

Sameer Borate's Blog:
Downloading Gmail attachments using PHP
May 08, 2012 @ 14:08:40

Sameer Borate has a quick tutorial posted to his site today about using PHP, specifically the IMAP functionality, to grab attachments off of emails from Gmail.

Automatically extracting attachments from Gmail can be important for reasons where you need to process the attached files periodically with a CRON job. Also it can be useful for automatically archiving important attachments. Below is a simple proof-of-concept plain PHP code, devoid of any object-oriented features that extracts attachments from your Gmail account. It uses PHPs imap extension to access the inbox.

His simple script opens an IMAP connection to the Gmail server and loops through your current emails (max of 16) and tries to find any that have attachments. It then extracts this part of the message, base64_decodes it, and saves the set of them to the local file system. You can download the source here.

tagged: gmail attachment tutorial download imap

Link:

9Lessons:
Import GMail Contacts Google OAuth Connect with PHP
Jun 17, 2011 @ 16:11:15

In a recent post to the 9Lessons.info site, Srinivas Tamada shows you how to connect Gmail with your system to import contacts via the magic of OAuth (pulled from Gmail to you).

Inviting friends is the most important part of the web project success. This post explains you how to import Gmail contacts from address book via Google open authorization protocol connect with PHP. It’s simple just few configurations follow below four steps, use this script and give option to invite more friends.

Following a few simple steps and using this simple script - registering the domain under Google Accounts, verify ownership and use the OAuth consumer and secret keys in the script. It's then simple to grab the contacts and output their details as the "Contacts.php" example script shows.

tagged: gmail contacts oauth connection tutorial export

Link:

PHPBuilder.com:
Downloading and Parsing Gmail Messages in PHP
Sep 01, 2010 @ 14:21:04

New on PHPBuilder.com today there's a tutorial showing you how to download and parse messages from Google Mail. In their case it's grabbing and parsing submissions from a form.

Some friends of mine publish a literary journal that accepts submissions via email. At their request I wrote a script to download messages from the journal's Gmail account and do some simple parsing tasks. Most of the submissions are made using an HTML form and a corresponding mailer script on their website, so I knew the precise format of the incoming messages (see Figure 1). What I didn't know was how to access Gmail in PHP.

He tried out the libgmailer script first, but ran into roadblocks until he realized he could use something PHP already had - the imap functions. With these he shows how to make a connection to the Gmail servers, get the listing of messages and pull out the body for the one you want to parse.

tagged: gmail google mail parse imap tutorial

Link:

SeeIT Consult Blog:
PHP mail() with Ubuntu Desktop and Gmail
Aug 27, 2010 @ 13:57:20

In this new post to the SeeIT Consult blog they show you how to use the Google Mail STMP service to send emails directly from PHP - no local MTA required.

I use a local Apache/MySQL server on a laptop to do a lot of my development – I don’t need a full mail server just to send mail. Also SMTP servers on dynamically assigned IP addresses are so untrusted these days that you can be pretty much guaranteed that a decent spam filter will reject your email based on a RBL lookup. By using Google Mail’s authenticated SMTP service you bypass this restriction.

Their solution uses the ssmtp tool instead - a simpler MTA that doesn't require near the setup of others. They show you how to adjust the config to handle the PHP emails, set up some users and configure PHP (the sendmail_path in the php.ini) to push the emails through it. Because of the configuration changes, it then knows enough to push those emails out to Gmail's SMTP.

tagged: gmail smtp tutorial ssmtp mta email

Link:

Web Development Blog:
Sending e-mails via SMTP with PHPmailer and Gmail
Sep 04, 2009 @ 19:56:14

On the Web Development Blog there's a recent post about using the PHPMailer package to send email out via the Google Mail servers.

These days I tried some plugin to send mail message within bbpress via SMTP. Since my domains email is hosted with Google applications I decided to send my messages via the SMTP server from Gmail. I found several articles and tutorials, but a lot of them didn’t work for me. [...] You need for this code example a PHP5 enabled web host (I tested only on Linux), the port 465 need to be open and of course you need a Gmail or Google applications account.

Complete code is provided - a smtpmailer function that takes in the standard mail parameters (to, from, subject, msg) and ships the message off to the Gmail STMP servers (on their custom port 465).

tagged: email tutorial gmail phpmailer stmp

Link:

VulgarisOverIP:
Send email with PHP and GMail hosted for your domain
Mar 28, 2006 @ 13:31:25

GMail's "for your domain" email feature has already impressed quite a bit of the industry, but have you ever wished for something a little bit more? Have you wanted to be able to send things the same way, but from a PHP script? Vulgarisoip is here to help.

Now that GMail for your domain has arrived (if you're a lucky beta winner, that is) it's like hiring a world-class email server engineer and paying them nothing. It takes a little work because of GMail's security requirements, but you end up with a rock solid email server that won't send messages straight into spam folders.

He uses the PHPMailer pakcage to do the dirty work - ensuring the headers are correct and providing a simple API for your scripts to use. There's a brief code example with a small explaination, but there's really not that much to it - any coder could integrate it easily.

[digg it]

tagged: send email gmail hosted domain phpmailer send email gmail hosted domain phpmailer

Link:


Trending Topics: