PHP
  Home arrow PHP arrow Embedding Attachments into Email Messages with Swift Mailer
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
iPad news and developer info.
Ads by affinity 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Forums Sitemap 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Embedding Attachments into Email Messages with Swift Mailer


By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2010-02-25


    Table of Contents:
  • Embedding Attachments into Email Messages with Swift Mailer
  • Review: attaching dynamically generated files with Swift Mailer
  • Working with inline attachments with the setDisposition() method
  • Introducing the embed() method

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Summary: In this ninth part of a ten-part series, you'll learn how to use a couple of methods provided by Swift Mailer to directly embed attachments into email messages. These can be very helpful when sending newsletters that contain numerous images, which you don’t want to be filtered and discarded by popular web-based email systems such as Hotmail and Yahoo.

    Embedding Attachments into Email Messages with Swift Mailer
    (Page 1 of 4 )

    Among the huge variety of email libraries written in PHP 5, there's one that stands out from the rest due to its well-structured programming interface, strict use of the object-oriented paradigm, and (if all of these features aren't good enough for you), its incredibly flat learning curve.

    Of course, as you might have guessed from this article's title, I'm speaking specifically of Swift Mailer. It's a powerful package that you can download freely at http://swiftmailer.org that will let you build complex email applications in a few simple steps. You'll make use of its intuitive API and clever implementation of some key concepts applied to software development, such as design patterns and object aggregation.

    Naturally, this isn't breaking news for you if you've read the previous articles in this series. In them, I explored the most relevant features offered by Swift Mailer, including its ability to send email messages formatted in HTML, as well as its capacity for attaching files from multiple locations on local hosts and remote servers.

    Nevertheless, at this point I'm only scratching the surface when it comes to demonstrating Swift Mailer's impressive capabilities for handling attachments. You see, so far, all of the examples developed in the previous parts of the series showed how to annex files to an email message by assigning an "attachment" value to the "Content-disposition" MIME header, which works well. But there are cases where this might not be good enough.

    For example, what if you need to embed a bunch of images directly into a message? Say you're sending a newsletter and you want to make it much more appealing to your web site's visitors. This is a good but scary question, isn't it? Fear not, because Swift Mailer permits you to manipulate MIME headers in a straightforward fashion, thus allowing you to embed files directly into emails very easily.

    So, in the next few lines I'm going to explain in depth how to use embedded attachments with the Swift Mailer library, which will hopefully be an instructive experience for you. Let's get going!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - MVC and the Zend Framework
    - PHP: Rendering Web Pages Using the Composite...
    - PHP: Creating Dynamic Web Pages with the Com...
    - Secure Encrypting and Decrypting for Your PH...
    - PHP: Creating Single View Objects with the C...
    - PHP: View Object Collections and the Composi...
    - Securing Your PHP Website
    - Determine Link Relevance and Unique Class C ...
    - PHP Composite View Design Pattern: Introduci...
    - Facebook PHP API Applications: A Second Look
    - Secure PHP Programming
    - Facebook PHP API Applications: Basic Introdu...
    - SOAP Servers and Web Services
    - Using XPath, SOAP, and More with Web Services
    - Web Services: SimpleXML


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code

     


     


    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek