在电子邮件主题中上传文件名

时间:2014-10-30 07:22:23

标签: php email subject

下面的代码将在Email Body中显示文件名,但我希望它也出现在Email Subject中。 我将把$ files_list放在哪个主题?

我试过

 'subject'  => __('$files_list uploaded for you','cftp_admin') 
 'subject'  => __($files_list.'New files uploaded for you','cftp_admin'),

不工作。这是代码:

$email_strings_file_by_user = array(
                                'subject'   => __('New files uploaded for you','cftp_admin'),
                                'body'      => __('The following files are now available for you to download.','cftp_admin'),
                                'body2'     => __("If you prefer not to be notified about new files, please go to My Account and deactivate the notifications checkbox.",'cftp_admin'),
                                'body3'     => __('You can access a list of all your files or upload your own','cftp_admin'),
                                'body4'     => __('by logging in here','cftp_admin')
                            );




function email_new_files_for_client($files_list)
{
    global $email_strings_file_by_user;
    $this->email_body = $this->email_prepare_body('new_file_by_user');
    $this->email_body = str_replace(
                                array('%SUBJECT%','%BODY1%','%FILES%','%BODY2%','%BODY3%','%BODY4%','%LINK%'),
                                array(
                                    $email_strings_file_by_user['subject'],
                                    $email_strings_file_by_user['body'],
                                    $files_list,
                                    $email_strings_file_by_user['body2'],
                                    $email_strings_file_by_user['body3'],
                                    $email_strings_file_by_user['body4'],
                                    BASE_URI
                                ),
                                $this->email_body
                            );
    return array(
                'subject' => $email_strings_file_by_user['subject'],
                'body' => $this->email_body
            );
}

1 个答案:

答案 0 :(得分:0)

您的__(.....)函数可能用于语言翻译,因此请将变量$files_list附加到翻译中,作为更改:

'subject'  => __($files_list.'New files uploaded for you','cftp_admin'),

'subject'  => $files_list . __('New files uploaded for you','cftp_admin'),