What is the format for e-mail headers that display a name rather than the e-mail?

后端 未结 3 1162
时光取名叫无心
时光取名叫无心 2020-11-29 02:37

I\'m trying to create a php script that will handle a mailing list for me using a mySQL database, and I have most of it in place. Unfortunately, I can\'t seem to get the he

3条回答
  •  余生分开走
    2020-11-29 03:20

    To have names, as opposed to email addresses shown, use the following:

    "John Smith" 
    

    Easy.

    Regarding the broken line breaks, that is because you are enclosing the text in apostrophes rather than quotation marks:

    $headers = array(
      'From: "The Sending Name" ' ,
      'Reply-To: "The Reply To Name" ' ,
      'X-Mailer: PHP/' . phpversion() ,
      'MIME-Version: 1.0' ,
      'Content-type: text/html; charset=iso-8859-1' ,
      'BCC: ' . $emailList
    );
    $headers = implode( "\r\n" , $headers );
    

提交回复
热议问题