Send HTML in email via PHP

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

    You need to code your html using absolute path for images. By Absolute path means you have to upload the images in a server and in the src attribute of images you have to give the direct path like this .

    Below is the PHP code for your refference :- Its taken from http://www.php.net/manual/en/function.mail.php

    Here are the birthdays upcoming in August!

    '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: Mary , Kelly ' . "\r\n"; $headers .= 'From: Birthday Reminder ' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?>

提交回复
热议问题