简体   繁体   中英

Set Sender Name in email

I have this php code which I wrote for Joomla Contact form! Everything is working fine, except it is taking sender email instead of taking sender name, kindly suggest, below is my helper.php

public static function sendEmailNotification($name, $email, $contact, $params){
        $app  = JFactory::getApplication();
        $menu = $app->getMenu()->getActive()->title;
        $mailer = JFactory::getMailer();
        $sender = array($params->get('sender_email'), $params->get('Busibells'));
        $mailer-> setSender($sender);
        $mailer-> addRecipient($params->get('receiver_email'));
        $mailer-> addCC($params->get('cc_email'));
        $mailer->setSubject('new mail submitted');
        $body = "<h3>A new user has contacted with the following information</h3> <br>";
        $body.="Name : $name<br>";
        $body.="Email : $email<br>";
        $body.="Contact : $contact<br>";
        $body.="Service Page: $menu";
        $mailer->setBody($body);
        $mailer->isHTML(true);
        $mailer->send();

    if($mailer->send()){
            $mailernew = JFactory::getMailer();
            $sendernew = array($params->get('sender_email'), $params->get('Busibells'));
            $mailernew-> setSender($sendernew);
            $mailernew-> addRecipient($email);
            $mailernew->setSubject('Welcome Mail');
            /*$body = body($params->get('welcome_message'));*/
            $body = '<!DOCTYPE html>

i think there no problem in your code.you should check that what value is coming in $params->get('Busibells'). May be you taking wrong parameter filed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM