There is one last method that we will discuss. In addition to the JMail class, there is a
static JMailHelper class. This class mainly consists of methods designed to clean data
before adding to an email (we don't have to use these, JMail takes care of it for us).
There is another method in the helper, isEmailAddress(). This method confirms
that an email address is of a valid format. This is especially helpful if we ever ask
users to input their email address:
if (!JMailHelper::isEmailAddress($someEmailAddress))
{
$this->setError(JText::_('INVALID_EMAIL_ADDRESS'));
return false;
}
Chapter 10
[ 297 ]
If we haven't used the JMail class earlier in the script, we will need to import the
JMail library before we use the JMailHelper class:
jimport('joomla.utilities.mail');
File Transfer Protocol
FTP has long been established as the standard way for administrators to transfer files
to their web servers. Joomla! provides us with the JFTP class, which can be used to
connect to FTP servers and perform common functions.
Pages:
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408