I am new to Joomla as I am still learning the ins and out of the
cms/framework, but one thing I do know is that we should not have to
reinvent the wheel.
We should be able to add vendor libraries into Joomla like Zend
Framework or Symfony Components.
In this example you could use the Zend_Mail class which has a similar
interface to the one you describe.
Maybe this is possible in Joomla, I just haven't seen it. Should be
easy enough with Zend's Autoloader.
On 6/25/2010 9:33 AM, Gary Mort wrote:
As my dayjob involves email deliver-ability, I have long loathed the
Joomla Email functionality.
It is extremely basic, locked into specific and downlevel email
libraries[PHPMailer for the longest time was languishing in obscurity
and far outpaced by Swiftmail in functionality. Now the reverse is
happening and new versions of PHPMailer are getting the functionality.
Yet still Joomla is stuck with an old old version of PHPMailer].
Plus it is extremely limiting, in my mind, for a component to send
email directly to users.
To me, a much better model would be as follows:
$userMessage = new JMessage;
$userMessage->setRecipient($joomlaUser);
$userMessage->setSender($joomlaUser);
// HTML message suitable for web or email
$userMessage->setRichHTML('some html formatted email');
// HTML message suitable for Cell or PDA
$userMessage->setBasicHTML('some html formatted message');
//Long Text Message
$userMessage->setLongText('some long text message');
//Medium text message
$userMessage->setMediumText('some short summary message, max of 1024
chars');
//Short text message
$userMessage->setShortText('some short text message, max 230 chars');
//Add some files
$userMessage->attachFile($fileHandle);
// Optionally, set a preferred medium
$force=false;
$preferred='email';
// What kind of message is this? Types could be confirmation, normal,
or batch
$type='normal'
// Send the message
$userMessage->sendMessage($type, $preferred, $force);
So that basically, when you get to the send message part, the message
is saved to a messaging queue table and based on the recipients
preference, they can receive the message in a number of different ways.
If they prefer to receive notices by IM or SMS text message, then you
send them the short text message with a link to the rich html version
online.
If they prefer email, then you send a MIME email with the rich HTML
and the basic Text.
If the user has a flag set for text only, and you have a text version
send just the text.
If the user has a flag set for low impact html, or wants an MMS, send
the basic html.
If they prefer private internal message, you can send it to the
internal system, which may trigger a new round of notifications being
sent.
[Note: the type of message is important, primarily to differentiate
between batch notices like "a forum thread you posted to has been
updated" and "new content has been added to this section"...and
messages like "confirmation of your order".... For batch notices, one
could allow a user to have additional settings such as "only send me
batch notices once an hour or once a day".... so instead of getting 50
forum update notices, they will get one notice at the end of the hour
the first one is put in the queue with all the medium text fields
appended together].
So, why do I hate drupal? Because someone has already done it!
http://drupal.org/project/messaging
*sigh* Now, I was willing to code all that for my own usage....
but figured no one else would ever use it.... But if it already
exists, there isn't much reason for me to code it for Joomla.... :-(
_______________________________________________
New York PHP SIG: Joomla! Mailing List
http://lists.nyphp.org/mailman/listinfo/joomla
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP SIG: Joomla! Mailing List
http://lists.nyphp.org/mailman/listinfo/joomla
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php