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
Sep 16, 2014 @ 14: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.

tagged: tutorial send email attachment multipart zendframework2 zendmail

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

Paul Reinheimer's Blog:
Sending Mail
May 23, 2012 @ 17:58:29

Paul Reinheimer has posted about his experiences with sending mail, specifically as it relates to using the Zend_Mail component from the Zend Framework to handle the details.

Like every product, Natural Load Testing needs to send some mail, having written and re-written a bunch of different blocks of mail code over the years, I wanted to come up with something that would work now, and continue to serve us well into the future.

He chose Zend_Mail to fulfill some of his requirements (multipart emails, sending custom emails, templates for automatic emails) and includes some sample code showing it at work. The result is an object that can be created and, by calling a "basic" method, can send an email based on an HTML template (using the HTML Email Boilerplate for the base styling).

tagged: send email zendmail tutorial template

Link:

ZendCasts.com:
Painless HTML Emails with Zend_Mail
Jun 23, 2010 @ 13:45:59

On the ZendCasts.com site today there's a new screencast posted looking at using the Zend_Mail component of the Zend Framework to easy (and painlessly) send HTML emails.

Here’s a quick video explaining how quickly and easy it is to write designer-friendly HTML emails using Zend_View and Zend_Mail.

You can watch the screencast via their in-page player and grab a copy of the project to follow along.

tagged: zendframework zendmail zendview screencast html tutorial

Link:

Web Development Blog:
PHP Mail Scripts using SMTP transport, a guide for beginners
Apr 12, 2010 @ 15:47:47

From the Web Development Blog today there's a new tutorial showing you how to use STMP from PHP via one of three different tools - the Zend_Mail component of the Zend Framework, SwiftMailer and PHPMailer.

PHP has a very simple mail function which is used very often for basic text mail messages. What if you need to attach files or if you need to send your e-mail messages via SMTP? Than it’s time to use a more advanced script. This is because the standard mail function has only limited standard capabilities.

Snippets of code are included for each of the three showing how to send a simple email with the usual "To", "From" and body contents. All of the tools have the ability to include attachments, but that's not included here.

tagged: smtp tutorial beginner swiftmailer zendmail phpmailer

Link:

Adrian Schneider' Blog:
Testing Zend_Mail
Feb 15, 2010 @ 17:09:56

In needing to test some mailing functionality in his application Adrian Schneider has come across two ways to handle it on a machine that may not have mail up and configured correctly - mail a mail transport class or sent up a pseudo mail server.

I think a staging environment is more appropriate to actually have email being sent out. Nevertheless, it has made testing any email functionality a little cumbersome. I've done a little research, and have found two ways to tackle the problem. I've also included code samples and other resources to get you started.

The first method - the transport class - uses the Zend_Mail_Transport component (and interfaces) to set the transport for the application and handle the routing from an extension of the Abstract class. The second method involves changes to system settings in the php.ini and adding in a simple script to force a forward to the right address. Windows users can also use fakemail to accomplish a similar thing.

tagged: test zendmail transport phpini fakemail tutorial

Link:

ElectricToolBox.com:
Method chaining with PHP
Dec 22, 2008 @ 18:37:07

On the ElectricToolBox.com blog there's a quick post looking at method chaining in a Zend Framework application:

Having used the Zend Framework on a couple of projects and spent a lot of time reading the documentation I discovered the use of method chaining. This post looks at how to use method chaining in PHP.

His examples include a comparison between a method-chained Zend_Mail example and a non-chained method with each line augmenting the same object over and over. He also includes the simple-as-pie method that lets you use chaining in your own applications - returning the object itself.

tagged: method chain zendframework zendmail tutorial example

Link:

Developer.com:
Sending Email with PHP
Nov 05, 2008 @ 13:58:47

On the Developer.com website today, Jason Gilmore has a new tutorial covering a important feature of any based PHP install (unless disabled, of course) that is widely taken advantage of - sending emails.

Email plays a crucial role in website development, whether you'd like to confirm a new registrant's email address, recover a lost password, or provide prospective clients with a convenient means to contact you. [...] In this tutorial, I'll introduce you to several solutions for sending email using PHP, including PHP's native mail() function, PEAR's Mail package, and the Zend Framework.

He starts with some of the fundamentals of mail - the difference between POP3 and SMTP, Sendmail, etc - before moving on to an example of the mail function's usage. He does the same with the PEAR Mail package and the Zend_Mail component of the Zend Framework.

tagged: send email mail pear zendmail zendframework tutorial

Link:

Eran Galperin's Blog:
Handling mail and mime in PHP using the Zend Framework
Jul 18, 2008 @ 13: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.

tagged: zendframework email zendmail mime attachment pop3 read smtp custom

Link:

PHPImpact Blog:
From Swift Mailer to Zend_Mail
Jun 27, 2008 @ 12:55:48

On the PHP::Impact blog, there's a new post talking about his conversion from Swift Mailer over to the Zend_Mail component of the Zend Framework.

I've recently switched from Swift Mailer to Zend_Mail and, to be honest, I'm loving it. Finally someone developed a lightweight, powerful and easy to use Mail component!

He includes an example or two showing a basic mailer script, one that uses a fluent interface, one sending an HTML email and two that show how to use a remote SMTP server.

tagged: zendmail swiftmailer change example tutorial zendframework

Link:


Trending Topics: