All pastes #2109677 Raw Edit

Something

public text v1 · immutable
#2109677 ·published 2012-02-04 13:14 UTC
rendered paste body
		# Fill mail object with data
		$destinationEmails = preg_split('/[ ,;]/', $dfcontact['destinationMail']);
		foreach ( $destinationEmails as $destinationMail ) {
			if ( $destinationMail != '' ) {
				$mail->addRecipient( $destinationMail );
			}
		}
		$mail->setSender( array( $app->getCfg('mailfrom'), $app->getCfg('fromname') ) );
		if ( !empty( $email ) ) {
			$mail->addReplyTo( array($email, $name) );
		}
		$mail->setSubject( $subject );
		
		# Set mail body
		if ( !empty( $dfcontact['htmlMails'] ) ) {
			$mail->isHTML( true );
			$mail->Body = utf8_encode($html);
			$mail->AltBody = utf8_encode($text);
		} else {
			$mail->Body = utf8_encode($text);			
		}
		
		# Try to send email and display result
		$sendResult = $mail->Send();
		if ( is_bool($sendResult) && $sendResult == true ) {
			echo '<p class="dfContactSubmitSuccess">' . JText::_( 'COM_DFCONTACT_FORM_MAIL_SUCCESS') .  '</p>' . "\n";
			if ( !empty( $dfcontact['displayUserInput'] ) ) {
				echo '<p class="dfContactSubmitVars">' . JText::_( 'COM_DFCONTACT_FORM_MAIL_SUBMITTED_VARS') . '</p>' . "\n";
				echo $sentVars;
			}
		} else {
			echo '<p class="dfContactSubmitError">' . JText::_( 'COM_DFCONTACT_FORM_MAIL_ERROR') . '</p>' . "\n";
			echo $backlink;
		}
	}
} else {