Skip to content

Instantly share code, notes, and snippets.

@anselmobattisti
Created February 19, 2019 19:40
Show Gist options
  • Save anselmobattisti/eb2a5891a3172cf177b80defde7ff7bd to your computer and use it in GitHub Desktop.
Save anselmobattisti/eb2a5891a3172cf177b80defde7ff7bd to your computer and use it in GitHub Desktop.
send email using joomla
# Invoke JMail Class
$mailer = JFactory::getMailer();
# Set sender array so that my name will show up neatly in your inbox
$mailer->setSender($data[‘mailfrom’]);
# Add a recipient — this can be a single address (string) or an array of addresses
$mailer->addRecipient($user->email);
$mailer->setSubject(utf8_decode($subject));
$mailer->setBody($body);
# If you would like to send as HTML, include this line; otherwise, leave it out
$mailer->isHTML();
# Send once you have set all of your options
$return = $mailer->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment