PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

php怎么发HTML格式的EDM邮件

原创
2016-06-06 20:51:48 1193浏览

网上貌似没有相关代码,看到sf发的EDM邮件,不知道是用什么相关原理做的,感觉没有思路

使用php自带的mail,直接变成了html的代码

回复内容:

网上貌似没有相关代码,看到sf发的EDM邮件,不知道是用什么相关原理做的,感觉没有思路

使用php自带的mail,直接变成了html的代码

php手册里有发送HTML邮件的例子:

Birthday Reminders for August

Here are the birthdays upcoming in August!

PersonDayMonthYear
Joe3rdAugust1970
Sally17thAugust1973

'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary , Kelly ' . "\r\n"; $headers .= 'From: Birthday Reminder ' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?>

使用mail函数的话,可以通过sendmail/postfix/exim之类的邮件代理来发。

或者使用phpmailer这个smtp库发。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。