Enviando e-mail com Joomla
|
Categoria: Joomla
|
Publicado em 27 de Setembro de 2010
|
Use o código abaixo para enviar e-mail dentro do framework do Joomla:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Make sure all the classes being used are imported
if(!defined('CMSLIB_DEFINED'))
include_once ( JPATH_BASE. '/components/libraries/cmslib/spframework.php');
// Imports JMail library
jimport('joomla.mail.mail');
// Gets Joomla configuration
$jconfig = new JConfig();
// Gets instance to e-mail object, with everything configured
$mail =& JFactory::getMailer();
// Sender
$mail->setSender( $jconfig->mailfrom );
// Recipient
$mail->addRecipient( "
Este endereço de e-mail está protegido contra spambots. Você deve habilitar o JavaScript para visualizá-lo.
" );
// Subject
$mail->setSubject( "Assunto do e-mail" );
// E-mail content (body)
$mail->setBody( "Conteúdo do e-mail" );
// Actually sends the e-mail
$mail->send();
|
$mail =& JFactory::getMailer(); $mail->setSender( $jconfig->mailfrom ); $mail->addRecipient( $mailInfo->email ); $mail->setSubject( $mailInfo->title ); $mail->setBody( $mailInfo->content ); $mail->send();
|