加入测心网,获得更多

无论您想服务网友,还是想获取帮助(如批量调查或测试),可以微信/QQ:57762787

wordpress由用户驱动发送邮件

使用场景举例:用户注册、发送测试结果等

模板singe中添加代码:

<?php
if (isset($_POST['useremail'])){
$to = $_POST['useremail'];
$subject = $_POST['usertitle'];
$body = $_POST['userresult'];
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $body, $headers );
}
?>

文章内添加代码:

<form action="" method="post" name="mymail">
请输入常用邮箱:<br />
<input name="useremail" type="text" value=""/>
<input name="usertitle" type="text" value=""/>
<input name="userresult" type="text" value=""/>
<input type="submit" value="发送邮件"/>
</form>

打赏作者,期待美好

打赏鼓励作者,为网友提供更多更好的测试,也许一瓶水就够了。

赞 (0) 打赏

评论

6+4=

打赏作者,期待更多

微信扫一扫打赏