本文介绍了我想在这个邮件功能中使用bcc或cc函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的邮件功能
<?php
//发送电子邮件用户激活帐户
$ activation ='activation.php?key = 。 $键;
$ your_email ='[email protected]'; //更改您的设置
$ domain = $ _SERVER [HTTP_HOST]; //你的域和扩展
$ to = $ email;
$ subject ='MyDomain激活帐户';
$ message。='< img src =http://mydomain.com/images/securedownload.jpg/>';
$ message ='欢迎,< br /> 。$ _ POST [用户名。。您必须通过此消息激活您的帐户才能登录。单击以下链接:http://'.$domain.'/'.$activation;
$ headers ='From:Mydomain<'。$ your_email。'@'。$ domain。'> \r\\\
'; //修改你的设置
$ headers。='Content-type:text / html\r\\\
';
mail($ to,$ subject,$ message,$ headers);
?>
解决方案
这很简单,只要分享,如果有人得到帮助从这里:
// ......
//...其他设置在这里.. ..
//发送HTML电子邮件时始终设置内容类型
$ headers =MIME-Version:1.0。 \r\\\
;
$ headers。=Content-type:text / html; charset = UTF-8。 \r\\\
;
//更多标题
$ headers。='From:My Name< [email protected]>'。 \r\\\
;
//可以添加多个CC,如果我们需要(逗号分隔);
$ headers。='Cc:[email protected],[email protected]'。 \r\\\
;
//多个BCC,与上述CC相同;
$ headers。='Bcc:[email protected],[email protected]'。 \r\\\
;
mail($ to,$ subject,$ message,$ headers);
i want to use bcc or cc function in this mail function?
Here My Mail Function
<?php
//SENDS EMAIL THAT TELLS THE USER TO ACTIVATE THE ACCOUNT
$activation = 'activation.php?key='.$key;
$your_email = '[email protected]'; //CHANGE TO YOUR SETTINGS
$domain = $_SERVER["HTTP_HOST"]; //YOUR DOMAIN AND EXTENSION
$to = $email;
$subject = 'MyDomain Activate Account';
$message .='<img src="http://mydomain.com/images/securedownload.jpg"/>';
$message = 'Welcome,<br/> '.$_POST['username'].'. You must activate your account via this message to log in. Click the following link to do so: http://'.$domain.'/'.$activation;
$headers = 'From: Mydomain<'.$your_email.'@'.$domain.'>\r\n'; //MODIFY TO YOUR SETTINGS
$headers .= 'Content-type: text/html\r\n';
mail($to, $subject, $message, $headers);
?>
解决方案
It is very simple, just sharing if anyone gets help from here:
//......
//...Other setting goes here....
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: My Name <[email protected]>'. "\r\n";
//Multiple CC can be added, if we need (comma separated);
$headers .= 'Cc: [email protected], [email protected]' . "\r\n";
//Multiple BCC, same as CC above;
$headers .= 'Bcc: [email protected], [email protected]' . "\r\n";
mail($to, $subject, $message, $headers);
这篇关于我想在这个邮件功能中使用bcc或cc函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!