|
|
|
|
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.


Mar 19, 2009 at 4:16 PM 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
Nov 9, 2009 at 9:59 AM I posted your blog to my facebook group
Regards
Courtney
Nov 12, 2009 at 5:26 AM 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
Nov 19, 2009 at 6:54 AM This seems like the most comprehensive blog on this niche
Regards