在电子邮件中设置发件人姓名

时间:2017-06-07 04:56:35

标签: php joomla

我有这个为Joomla Contact表单编写的php代码!一切都运行正常,除了它接收发件人的电子邮件,而不是采取发件人的名字,善意的建议,下面是我的帮手.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>

1 个答案:

答案 0 :(得分:0)

我认为您的代码没有问题。您应该检查$ params-&gt; get(&#39; Busibells&#39;)中会出现什么价值。可能是您提出错误的参数