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/

Codeception.com:
Testing Emails in PHP. Part 1 PHPUnit
December 18, 2013 @ 13:04:05

On Codeception.com an tutorial has been posted showing you how to use PHPUnit to test emails - verifying that your application emails are being sent with the help of a third-party service.

So how do you check that your applications sends email correctly? It looks like dealing with emails is always a challenge. How would you verify that email message is formatted and delivered correctly, without actually sending them to your clients? That's the first question. And the second question is: how can we automate testing of emails? For both questions we have an answer.

To answer the first, they recommend using a service like Mailtrap or Mailcatcher (the one they use for the post) to receive the emails for evaluation. They help you get both PHPUnit and the popular Guzzle HTTP library installed to help with resting against Mailcatcher's REST API. The example test is also included, showing a few methods that connect to the API, get the most recent messages and clear the list when it's complete. Assertions like assertEmailIsSent, assertEmailHtmlContains and assertEmailSenderEquals show how to test the message results that come back for validity.

0 comments voice your opinion now!
test unittest phpunit email send mailcatcher rest api

Link: http://codeception.com/12-15-2013/testing-emails-in-php.html

NetTuts.com:
Sending Emails With Laravel 4 & Gmail
December 18, 2013 @ 11: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.

0 comments voice your opinion now!
send email tutorial gmail laravel template

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

Snipe.net:
Sending Mail Using PHP and Amazon SES on Centos/AWS Linux
March 27, 2013 @ 10:56:53

In this new post to her site Alison shows how to send emails through the Amazon Simple Email Service (SES) from a CentOS instance (an AMI in this case).

If you find yourself using Amazon SES for sending outgoing emails in a PHP web app, getting everything set up is much simpler than it may seem. In my case, this was on an AWS Linux image, but it will work on any Fedora/CentOS AMI. You can, of course, set up sendmail and use a proper MTA to send email from your web app, but in this case, I had inherited the requirement to set up an environment for code that was already written to use SES for outgoing email and Google Apps for incoming emails, so the actual mechanics weren't up for debate.

She includes screenshots showing how to configure the SES system with your site's domains and DNS as well as the email addresses you're planning on using. She links over to the MSMTP software you'll need to install on your instance to make the connection and what you'll need to do to get it configured for PHP's use. A sample email script is also included to test the connection (and where to look to make sure everything worked correctly).

0 comments voice your opinion now!
amazon ami ses email send centos tutorial


Rob Allen:
Sending an HTML with text alternative email with ZendMail
November 02, 2012 @ 10:26:20

Rob Allen has a quick tutorial posted to his site today showing you how to send an email with the ZendMail component of the Zend Framework 2 that contains HTML but provides a plain text backup in the same message.

Sending a multi-part email with ZendMail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!

The rest of the post is the code you'll need to send a simple email with a text and HTML body sections, configure the headers (to, from, etc) and the "multipart/alternative" header to make the HTML or plain text switching work correctly.

0 comments voice your opinion now!
zendframework2 mail tutorial send alternative html plaintext


Sebastian Göttschkes:
symfony2 Testing email sending
September 13, 2012 @ 08:52:03

Sebastian Göttschkes has a new post showing a method he's come up with to test email sending in a Symfony2 application.

On my endless struggle to achieving 100% code coverage and catching every possible (and impossible) test case (I'm just kiddinh, please don't do this!) I was in need for some way to test the sending of emails. This blog post will show you how to test this within a symfony2 (I'm using symfony 2.1 RC2) application, using the default swiftmailer.

It's not unit testing, it's functional testing, and he provides a bit of background on the process first then sets up a dummy listener for testing and how to plug in the Symfony2 functionality (via a getContainer call to get the DIC).

0 comments voice your opinion now!
symfony2 swiftmailer testing webtest email send


PHPMaster.com:
Implement Two-Way SMS with PHP
July 17, 2012 @ 08:46:22

PHPMaster.com has an interesting new article posted today showing how you can use PHP to create a two-way messaging (SMS) application that can both send and initiate actions based on message content.

SMS is used for various purposes these days. For example, major websites like Gmail and Facebook use SMS to improve their authentication process with multi-factor authentication and notifying users about the updates. These are one-way SMS applications since messages are sent only from these sites to the user. Two-way SMS applications are more complex than one-way ones. In two-way SMS apps, a user can initiate a conversation by sending messages, and then the application responds according to the user's commands.

They base the application on the Clickatell SMS service (not free, but cheap - pay by the message too) which includes the ability to hook into your API on a specific endpoint and relay the message data. The message can either be sent via a POST or GET and can easily be interpreted in your app extracting things like a timestamp, the number it came from and, of course, the actual text of the message. There's also a section about the "User Data Header" functionality that lets you easily split up a message for recombination on the remote device. Code is included for all examples.

0 comments voice your opinion now!
sms tutorial bidirectional send receive


Paul Reinheimer's Blog:
Sending Mail
May 23, 2012 @ 12: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).

0 comments voice your opinion now!
send email zendmail tutorial template


Cats Who Code:
Sending SMS with PHP and TextMagic An A to Z guide
March 27, 2012 @ 10:57:15

On the Cats Who Code site today there's a new tutorial showing how to send SMS messages from your PHP application with the help of the TextMagic service.

Over the years, Short message service (SMS) has become a very important way of communication, and many businesses are looking for easy ways to send automated text messages to their customers. In this tutorial, I'm going to show you how you can send SMS using PHP and a third party service called TextMagic. Its very easy to do!

They step you through the process - creating a TextMagic account, configuring the account with your own password and creating a simple script that includes their own API library and sends the SMS request.

0 comments voice your opinion now!
sms textmagic tutorial send api


Henrik Bjørnskov's Blog:
Stampie an in depth look
December 15, 2011 @ 12:48:25

Henrik Bjørnskov has posted a bit of an in-depth look at Stampie, an abstraction library for sending emails from PHP applications via various service providers (like SendGrid and Mailchimp).

So what is Stampie. Stampie is a API wrapper for the most common email sending services. It provides a standard PHP Api to send emails. But mostly it is a project to test TDD and experiment with a couple of different things. Stampie is developed with Dependency Injection and therefore there is a lot of objects. At the start it can be quite cumbersome, but will make a lot of sense if you start to develop and add additional provider.

He includes a bit of sample code showing the sending of a message via the SendGrid API backend. Extending the system is simpler thanks to DI and the customizable MailerInterface object type. There's also an AdapterInterface object that can be used to redefine the HTTP connection interface the tool uses. He also points to the HBStampieBundle bundle for the Symfony2 framework that can make dropping it into your current SF2 application simpler.

0 comments voice your opinion now!
stampie email send tutorial dependencyinjection tool



Community Events





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


opinion language application library release community security laravel composer voicesoftheelephpant install update introduction version podcast symfony framework interview package series

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