Custom mail send in joomla

We Are Professional

Custom mail send in joomla

# At first needed to define or get some basic mailing values
$subject = “Subject for dummy message”;
$body = “This the body part for demo purpose.”;
$to = “lmnmamun@gmail.com”;
$from = array(“mamun_cse005@yahoo.com”, “Al Mamun”);

# Then invoke JMail Class
$mailer = JFactory::getMailer();

# Now, set sender array so that my name will show up neatly in your inbox
$mailer->setSender($from);

# Add a recipient — this can be a single address (string) or an array of addresses
$mailer->addRecipient($to);

$mailer->setSubject($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
$mailer->send();
That’s all there is to it for sending a simple email. If you would like to add carbon copy recipients, include the following before sending the email:

# Add a blind carbon copy, if you want
$mailer->addBCC(“testtoabc@gmail.com”);

# You can check, is message send???
if ($mailer->Send()) {
echo “Mail sent successfully.”;
} else {
echo “An error occurred. Mail was not sent.”;
}

Information

WebinBangla is a leading web solution provider and we work globally. Wel make sure our clients and customers avail maximum benefits by using our high quality services and complete packages.

  • Address: Pahartoli, Raozan, Chittagong.
  • Email: mamun005cse@gmail.com
  • Phone: +880 1738 914871

Working Hours

  • Monday - Friday - 9am to 5pm
  • Saturday - 9am to 2pm
  • Sunday - Closed