PHP发送邮件代码
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php //使用网吧数据接口,发送邮件php demo //本程序,你只需要改配置值,然后直接运行即可 //======= //配置程序 //======= #网吧数据KEY $key = '14297580222735684725947490211595'; # smtp服务器地址, 如smtp.qq.com $host = 'smtp.qq.com'; # 发件人名称 $fromname = '昵称随便定义'; # 发件人邮箱账号 $username = 'QQ邮箱账号'; # 发件人邮箱密码 $passwd = 'QQ邮箱密码'; # 收件人邮箱账号 $to = '3039439790@qq.com'; # 邮件标题 $subject = '标题,您好!'; # 邮件内容,可以写HTML,等 $email = '内容,您好,这是我们为您准备的内容。'; //======= //逻辑处理程序 //======= $subject = urlencode($subject); $email = urlencode($email); $handle = fopen ("http://www.zgw8.com/api.php/SendMail/Index/key/".$key."/language/xml/smtp/".$host."/fajianrenmingcheng/".$fromname."/fajianrenyouxiang/".$username."/fajianrenyouxiangmima/".$passwd."/shoujianrenyouxiang/".$to."/youjianbiaoti/".$subject."/youjianneirong/".$email, "rb"); $contents = ""; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); function simplest_xml_to_array($xmlstring) { return json_decode(json_encode((array) simplexml_load_string($xmlstring)), true); } //======= //获取到结果的程序 //======= //返回值数组 $arr = simplest_xml_to_array($contents); //打印数组 print_r($arr); ?>