php mail函数发送带回执邮件

2013-11-30 13:07:08

[开发运维 | Dev Ops] , ,

php mail函数的自定义非常方便,也非常简单。

 

邮件的回执主要利用的是Header里面的 Disposition-Notification-To

 

 

 

Disposition-Notification-To

参数,后面跟回执目的地邮箱,然后添加到header里面,是mail()函数的第四个

 

 

 

参见代码
php发送带回执邮件

 

<?php
$to      = $_POST['sendto'];
$subject = $_POST['subject'];
$message = $_POST['content'];
$headers = 'From: '.$_POST['sendby'] . "\r\n" .
'Disposition-Notification-To: '.$_POST['sendby'] . "\r\n" .
"Content-Type: text/html; charset=utf-8 \r\n" .
'X-Mailer: PHP/' . phpversion();
$s = mail($to, $subject, $message, $headers);
if ($s==0) {
echo "发送失败!";
} else {
echo "发送成功!";
}
?>

 

这篇博文发表在 开发运维 | Dev Ops 目录下,标签为 , ,
如需引用,请使用链接:https://note.mc256.dev/?p=118

This article published in 开发运维 | Dev Ops with tags , , .
Cite this page using this link:https://note.mc256.dev/?p=118

您的邮箱地址不会被公开,评论使用Gravatar头像。
Your email address will not be published. This blog is using Gravatar.

正在提交评论... Submitting ...
正在为您准备评论控件 Loading Comment Plugin
Copyright © 2013-2024 mc256. All Rights Reserved.
Powered by WordPress on top of a dual-stack k3s Cluster using JuiceFS.
Wordpress Theme Designed By mc256.
Encrypted By Let's Encrypt.  Hosted On Linode + OVH + AWS.
DNS Provided By Hostker.
Status Page by CloudFlare Worker.