News Feed
Sections




News Archive
feed this:

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

Rob Allen:
Sending attachments in multipart emails with ZendMail
September 16, 2014 @ 09:18:09

Rob Allen has a new post today showing you how to use the ZendMail component of the Zend Framework 2 to send attachments with multipart emails. A multipart email allows you to combine both the HTML and plain text versions of the content into a single email.

I've written before about how to send an HTML email with a text alternative in ZendMail, but recently needed to send an attachment with my multipart email. With help from various sources on the Internet, this is how to do it.

He includes the full code for the example first: a "sendEmail" function that sets up the MIME and plain-text parts and uses the "MimeMessage" and "MimePart" objects to attach the file. He goes through each of the parts of the script and describes what's happening and how that changes the content of the email. You can find out more about the ZendMail component in this section on the Zend Framework manual.

0 comments voice your opinion now!
tutorial send email attachment multipart zendframework2 zendmail

Link: http://akrabat.com/zend-framework-2/sending-attachments-in-multipart-emails-with-zendmail/

Sameer Borate:
Downloading Gmail attachments in PHP - an update
July 29, 2014 @ 09: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.

0 comments voice your opinion now!
attachment download gmail tutorial search

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

SitePoint PHP Blog:
Handle Incoming Email with SendGrid
August 27, 2013 @ 10:30:34

On the SitePoint PHP blog today Lukas White has a new tutorial showing you how to handle incoming emails from SendGrid (well, pulled from SendGrid) and translate them into posts for your blog or site.

In this article, I'm going to look at how you might implement an email-to-post feature, using SendGrid. SendGrid is a service for sending email - usually in bulk, but they also offer a less well-publicized feature for handling incoming email. SendGrid can be configured to handle all incoming messages for a given domain by pinging a URI of your choosing, and by implementing a simple webhook, you can act on the incoming mail accordingly.

He bases the simple example off of the Slim framework, creating a structure with a basic database for users and posts. He then goes through the SendGrid interface, pointing out where you add the hostname and URL to call back when a new email comes in. He includes the code to create the callback functionality that accepts the POST request coming from SendGrid. This is then validated and inserted into the database to be pulled out later by the "posts" page. There's also a bit about saving images (or other files) that come in as attachments to the email.

0 comments voice your opinion now!
incoming email sendgrid callback post tutorial image attachment

Link: http://www.sitepoint.com/handle-incoming-email-with-sendgrid/

PHPMaster.com:
Exploring PHP's IMAP Library, Part 2
October 04, 2012 @ 10:36:22

PHPMaster.com has published the second part of their series taking you on a tour through PHP's IMAP extension and its use. In part one they introduced the extension and showed how to connect, get the folders/emails and view message contents. In this part they expand n that and show you how to work with the messages and attachments.

In the first part of this series I discussed how to connect to IMAP servers using PHP's IMAP extension. In this part we'll complete the series by discussing working with folders and reading email content. Let's get started!

He shows how to work with the "flags" set on messages (read, unread, replied, etc) - pulling them from the server and using the imap_setflag_full function to set them. There's a quick mention of deleting messages with imap_delete/imap_expunge and a section on viewing and downloading the attachments to messages.

0 comments voice your opinion now!
imap library extension tutorial series attachment flags delete


Sameer Borate's Blog:
Downloading Gmail attachments using PHP
May 08, 2012 @ 09: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.

0 comments voice your opinion now!
gmail attachment tutorial download imap


Gonzalo Ayuso's Blog:
Using a stream wrapper to access CouchDb attachments with PHP
September 06, 2010 @ 08:15:22

In his continuing look at using CouchDb as a file system, Gonzalo Ayuso has posted this third part in the group of articles about using streams to connect your scripts to the database instance.

I'm still working in my filesystem with CouchDb. After creating a library to enable working with PHP and CouchDB (see the post here), and after using Monkey Patching to override standard PHP's filesystem functions. I've created another solution now. Thanks to a comment in my last post (many thanks Benjamin) I've discovered that it's possible to create a stream wrapper in PHP (I thought it was only available with a C extension).

He includes the code for the stream connection wrapper, a pretty simple script that parses the string it's given and opens a read/write stream to the source. There's also a "url_stat" method that will return to you the size of the stream in bytes. Then you just register the wrapper and go about your normal file system calls to use the CouchDb directly.

0 comments voice your opinion now!
couchdb stream wrapper attachment tutorial


Andrew Johnstone's Blog:
Emailing Attachments Exim Filters and PHP streams
June 01, 2010 @ 08:51:28

New on his blog today Andrew Johnstone has a post about email attachments how how the combination of Exim filters and PHP streams can make things much easier for you and your application.

Using exim filters we could add attachments at the delivery stage, therefore reducing overhead in constructing and injecting data into an email. The delivery of emails varied as to whether it was feasible to send as a BCC or whether there were placeholders intended for each individual recipient. As such the following addresses the worst case scenario of attachments with placeholders intended for each individual recipient.

They show how to use a PHP script (that uses streams to pull in the file data and information) hooked into an exim_filter to streamline the attachment process. Configuration file examples are included in the post as well as the PHP source for creating the filter.

0 comments voice your opinion now!
email attachment stream tutorial exim filter


NETTUTS.com:
CodeIgniter From Scratch Day 3. Sending Emails and Attachments
August 04, 2009 @ 16:21:46

The NETTUTS.com site has posted the vidcast for the third day of their look at the CodeIgniter framework (and creating a full simple application with it).

At the request of some of our readers, this week, we'll examine just how easy it is to send emails with attachments using Gmail. With raw PHP, this would be a long and tedious task. However, with CodeIgniter, it's a cinch! I'll show you how in this eighteen minute video tutorial.

You can watch the video via their in-page player and grab the source code if you'd like to follow along.

0 comments voice your opinion now!
tutorial email attachment codeigniter framework


DevShed:
Sending Email with PHP Networking
September 16, 2008 @ 11:21:23

DevShed has the second of a two part tutorial posted today on sending emails with the included mail() function.

In this article we will look at the protocol that is involved in sending email messages. We will also examine the thorny issue of how to send an attachment with an email message. This article is the second of two parts.

They include examples of sending simple messages and more complex ones with things like attachments and custom headers. They also tack on a look at the PEAR::Mail package to the end showing how it can make sending some things a little less painful.

0 comments voice your opinion now!
email networking tutorial protocol simple complex attachment header


Eran Galperin's Blog:
Handling mail and mime in PHP using the Zend Framework
July 18, 2008 @ 08:47:27

On the Techfounder blog (from Eran Galperin) there's a quick tutorial about using the Zend_Mail component of the Zend Framework to send both normal, plain-text emails and ones with MIME attachments.

Using PHP's built in function (aptly named mail() ) is relatively straightforward - until you need slightly more advanced features, such as adding and encoding email headers or sending multiple mails efficiently. Fortunately, the Zend Framework comes with a very capable mail component called Zend_Mail.

He shows how to send a simple email, do something a bit more complex with a custom SMTP server, read messages from a remote POP3 email box and how to attach a binary file/message.

0 comments voice your opinion now!
zendframework email zendmail mime attachment pop3 read smtp custom



Community Events





Don't see your event here?
Let us know!


install framework library bugfix voicesoftheelephpant podcast introduction release language api community deployment series opinion unittest interview package zendserver laravel symfony

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework