PHP Send HTML mail

前端 未结 3 662
情话喂你
情话喂你 2021-01-26 21:46

I am trying to send an HTML mail through PHP, but I can\'t seem to get it working.

This is my code:

    // multiple recipients
    $to  = \'mail\';

             


        
3条回答
  •  死守一世寂寞
    2021-01-26 22:43

    I don't think you have to put the To: line in the header as it is a parameter of the mail function. However some mail clients don't like light headers, here's mine which is working:

    $header = 'From: "Contact" '.PHP_EOL.
                      'Reply-to: '.PHP_EOL.
                      'MIME-Version: 1.0'.PHP_EOL.
                      'Content-Type: text/plain; charset=utf-8'.PHP_EOL.
                      'Content-Transfer-Encoding: 8bit'.PHP_EOL.
                      'X-Mailer: PHP/'.PHP_VERSION.PHP_EOL;
    

提交回复
热议问题