简体   繁体   English

添加密件抄送PHP邮件功能

[英]Add bcc PHP mail function

Currently this is how the headers look like.目前这是标题的样子。 What should I do if I want to add a bcc.如果我想添加密件抄送怎么办。 Thanks for the help.谢谢您的帮助。 Below is what the code looks like.下面是代码的样子。

// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>

You would add this in the headers:您可以在标题中添加以下内容:

'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'Bcc: someone@example.com' . "\r\n" . 
'X-Mailer: PHP/' . phpversion();

As shown on the docs at PHP.netPHP.net上的文档所示

This is how my Mail function looks, with Bcc and cc这是我的邮件功能的外观,带有密件抄送和抄送

//Send email
Mail::send('emails.contactus',
     array(
            'name'         => $request->get('fname'),
            'designation'  => $request->get('jobtitle'),
            'orgn'         => $request->get('orgn'),
            'phone'        => request('countrycode')
        ), 
        function($message) use ($request)
        {
            $message->from('hello@xxxx.com','Name');
            $message->to('support@xxx.com', 'Name')->subject('New Enquiry from Website');
            $message->cc('rajiv@xxx.me');
            $message->Bcc('rajiv@xxx.me');
        });
    

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

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