Enviando e-mail

From Basef
Jump to: navigation, search

Use o código abaixo para enviar e-mail com Joomla:

$email = array();
 
// Pega configuração do Joomla
$email['config'] = &JFactory::getConfig();
 
// Configura as propriedades de envio
$email['message_fromname'] = 'Seu nome';
$email['message_from'] = 'emailremetente[arroba]email.com';
$email['message_to'] = 'emaildestinatario[arroba]email.com';
$email['message_subject'] = 'Seu assunto';
$email['message_text'] = "Sua mensagem";
 
// Envia o e-mail
if (!JUtility::sendMail( $email['message_from'], $email['message_fromname'], $email['message_to'], $email['message_subject'], $email['message_text']) ) {
	$this->setError('ERROR_SENDING_CONFIRMATION_EMAIL');
	return false;
}