Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to send email using joomla

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 214
    Comment on it

    We can easily send email in joomla using $mailer = JFactory::getMailer(); which invoke jMail class. It returns a reference to the JMail object.Below is the code which define how to send an email in joomla.

     -Invoke JMail Class
    $mailer = JFactory::getMailer();
    
    -Set sender array so that from name will show  in your inbox
    $mailer->setSender($from);
    
     -this can be a single address  or an array of addresses  of recipient
    $mailer->addRecipient($to);
    
     -Set subject of your email
    $mailer->setSubject($subject);
    
    -set content of your email
    $mailer->setBody($body);
    
     -If you would like to send as HTML, include this line; otherwise, leave it out
    $mailer->isHTML();
    
    -if attachment required in email
    $mailer->addAttachment($file);
    
    -Send once you have set all of your options
    $mailer->send();
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: