There is a global JMail object that we can access using the JFactory method
getMailer(). This object is configured with the global mail settings that
administrators edit through the Global Configuration Server settings:
Chapter 10
[ 295 ]
The first thing we need to do when we come to send an email is retrieve the JMail
object and set the sender's email address:
$mailer =& JFactory::getMailer();
$mailer->setSender('example@example.org');
There are two ways in which we can specify the email address. We can either use a
string, as in the given example, or we can use an array that defines the email address
and name:
$sender = array('example@example.org', 'example')
$mailer =& JFactory::getMailer();
$mailer->setSender($sender);
If we want to, we can add reply-to addresses. Unlike setting the sender, the email
addresses must either be an array of strings or an array of arrays:
$reply = array('example@example.org', 'Example');
$mailer->addReplyTo($reply);
$reply0 = array('example@example.org', 'Example');
$reply1 = array('example@example.
Pages:
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405