laravel 4.2 发送电子邮件显示附件的自定义名称

laravel 4.2 send email display custom name for the attachment

我有以下代码:

$message->to($user->W_EMAIL_ADDRESS, '')
        ->subject($user->W_SUBJECT.$user->W_SITE_ADDRESS)
        ->attach($user->W_PATH_FILE);

是否可以显示我在 files.name 中输入的值?

试试这个 ;)

$message->attach('path_to_pdf_file', array(
    'as' => 'name to display.pdf', 
    'mime' => 'application/pdf'));