我遇到了一些电子邮件问题的严重问题。
简而言之:
- 加载一个 html 模板文件
fopen
%password
用实际值替换一些值,像这样标记str_replace
- 通过以下函数发送邮件,
$content
加载的html模板文件在哪里:
公共函数发送($receiver, $subject, $content){
$header = "From:".sender. "\n";
$header .= "MIME-Version:1.0" . "\n";
$header .= "Content-type:text/html;charset=utf-8" . "\n";
$mailText = $content;
mail($receiver, $subject, stripslashes(iconv('utf-8', 'iso-8859-1', $mailText)) , $header);
}
服务器是带有后缀的debian。
邮件模板以
<html> <body style="background-color: #fff;"> <table border="0"...
问题是,我无法复制它,在某些情况下,我可以在邮件中找到几个空格,而我没有放在那里。最有问题的是用户和密码字符串中的那些。
其他一切似乎都是正确的!编码没问题,接受html,所有邮件都可以投递...
密码生成:
public static function create_password($length = 12) {
$characters = array("a", "b", "c", "d", "e", "f", "g", "h", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "_");
$password = "";
for($i=0; $i<$length; $i++) {
$index = rand(1, count($characters)) -1;
$password .= $characters[$index];
}
$password = str_replace("__","_", $password);
return $password;
}
任何想法,从哪里开始我的搜索?
是模板,str_replace,后缀,客户端,...?
感谢到目前为止