簡體   English   中英

在電子郵件中設置發件人姓名

[英]Set Sender Name in email

我有我為Joomla Contact表單編寫的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>

我認為您的代碼沒有問題。您應該檢查$ params-> get('Busibells')中傳入什么值。 可能是您輸入了錯誤的參數

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM