Send HTML in email via PHP

后端 未结 8 2096
时光说笑
时光说笑 2020-11-22 03:13

How can I send an HTML-formatted email with pictures using PHP?

I want to have a page with some settings and HTML output which is sent via email to an address. What

8条回答
  •  不知归路
    2020-11-22 03:14

    Sending an html email is not much different from sending normal emails using php. What is necessary to add is the content type along the header parameter of the php mail() function. Here is an example.

    
        
        HTML email
        
        
        

    A table as email

    Firstname Lastname
    Fname Sname
    "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\b"; $headers .= 'From: name' . "\r\n"; mail($to,$subject,$message,$headers); ?>

    You can also check here for more detailed explanations by w3schools

提交回复
热议问题