简体   繁体   English

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

[英]Set Sender Name in email

I have this php code which I wrote for Joomla Contact form! 我有我为Joomla Contact表单编写的php代码! Everything is working fine, except it is taking sender email instead of taking sender name, kindly suggest, below is my helper.php 一切正常,只是要使用发件人电子邮件而不是发件人姓名,请注意,以下是我的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'). 我认为您的代码没有问题。您应该检查$ params-> get('Busibells')中传入什么值。 May be you taking wrong parameter filed 可能是您输入了错误的参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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