Send HTML in email via PHP

后端 未结 8 2110
时光说笑
时光说笑 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:28

    You can easily send the email with HTML content via PHP. Use the following script.

    
    
        

    Send HTML Email Using PHP

    This is a HTMl email using PHP by CodexWorld

    '; // Set content-type header for sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // Additional headers $headers .= 'From: CodexWorld' . "\r\n"; $headers .= 'Cc: welcome@example.com' . "\r\n"; $headers .= 'Bcc: welcome2@example.com' . "\r\n"; // Send email if(mail($to,$subject,$htmlContent,$headers)): $successMsg = 'Email has sent successfully.'; else: $errorMsg = 'Email sending fail.'; endif; ?>

    Source code and live demo can be found from here - Send Beautiful HTML Email using PHP

提交回复
热议问题