E-dreamz Corporate Blog

portfolio

View some of our latest web site design projects, web applications, and internet marketing campaigns.
View Our Portfolio  

RFP request

Send us your project requests, ideas and questions.
Request for Proposal  

Emailz Direct

Convert one-time website visitors into repeat customers by instantly engaging them in high-value interactions.
Emailz-Direct  

Coldfusion vs. PHP :: Sending E-Mail

Justin Johnson , Engineering Add comments
Posted by: Justin Johnson


I've always lamented that sending mail in PHP, especially HTML formatted email, is a major pain. With ColdFusion is probably one of the simplest things you can do. Let's look at sending the email both with PHP and with ColdFusion

ColdFusion

<cfmail to="email@edreamz.com" from="email@edreamz.com" subject="Hey What's Up?">
<cfmailpart type="text">
Hi!, I'm the plain text portion of an email sent from ColdFusion.
Do you want to hang out this weekend?
Thanks,
ColdFusion Mailer
</cfmailpart>
<cfmailpart type="html">
Hi!,
<p> I'm the HTMLtext portion of an email sent from ColdFusion. Do you want to hang out this weekend? </p>
Thanks,<br />
<strong>ColdFusion Mailer</strong>
</cfmailpart>
</cfmail>

PHP

<?php
$email = "testing@edreamz.com";
$subject = "This is the Email Subject";
$message = "This is my email message";
mail($email, $subject, $message, "From: $email");
?>

Now one thing to note is that I have to repeat the mail() line for each PHP recipient, but for ColdFusion, I just use a comma seperated list: ex: to="email1@edreamz.com, email2@edreamz.com"

Now there are 3rd party libraries out there, for example: PHPMailer, that makes sending mail with PHP a little less painful. But the cool thing to me is that ColdFusion can do all this out of the box. No configuration, no third party library. Plus I'm not even touching on the fact that you can give the mail tag in ColdFusion a query and it will automatically loop over the query and send email to those in the query.

Share this:
del.icio.us digg StumbleUpon Facebook Technorati Fav Mixx Spurl newsvine Furl reddit FARK Yahoo! My Web Wists Simpy BlinkList BlogMarks smarking Ma.gnolia MSN Live Google Bookmarks Segnalo diigo excites

4 responses to “Coldfusion vs. PHP :: Sending E-Mail”

  1. Christopher Says:
    In php the last parameter in mail() also accepts extra header information. Where you can add cc and bcc. So, I would say they are about even. Beside the fact that php is open source and more widely supported.

    For those of you new to php: http://www.php.net/manual/en/function.mail.php
  2. Raleigh Painting Says:
    I posted your blog to my facebook group


    Regards
    Courtney
  3. car lease companies Says:
    Well this is very interesting indeed.Would love to read a little more of this. Great post. Thanks for the heads-up…This blog was very informative and knowledgeable
  4. Data Recovery Baltimore Says:
    This seems like the most comprehensive blog on this niche

    Regards

Leave a Reply