php 发送 Email
< ?php
require("mail/class.phpmailer.php");//调用
$mail = new PHPMailer();//实例化phpmailer
$address = "mailxi@126.com";//接收邮件的邮箱
$mail->IsSMTP(); // 设置发送邮件的协议:SMTP
$mail->Host = "smtp.163.com"; // 发送邮件的服务器
$mail->SMTPAuth = true; // 打开SMTP
$mail->Username = "我的账户"; // SMTP账户
$mail->Password = "我的密码"; // SMTP密码
$mail->from = "mailxi@163.com";
$mail->fromName = "peng";
$mail->AddAddress("$address", "");
//$mail->AddAddress(""); // name is optional
//$mail->AddReplyTo("", "");
//$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
//$mail->IsHTML(true); // set email format to HTML
$mail->CharSet = "UTF-8";//设置字符集编码
$mail->Subject = "Sinopf的测试邮件";
$mail->Body = "Hello,Sinopf的测试邮件";//邮件内容(可以是HTML邮件)
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. < p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo&nb
相关文档:
Php Variable Circular References
Circular-references has been a long outstanding issue with PHP. They are
caused by the fact that PHP uses a reference counted memory allocation
mechanism for its internal variables. This causes problems for longer
running scripts (such as an Applicatio ......
原型:string substr ( string $string , int $start [, int $length ] ),它可以用于在一个较长的字符串中查找匹配的字符串或字符。$string为所要处理的字符串,$start为开始选取的位置,$length为要选取的长度(当它是负数时为负数时表示右起数起的位置)。
例:
<?php
$rest1 = substr("abcdef", 0, 0); // returns ......
常量可以理解为值不变的变量。常量值被定义后,在脚本的其他任何地方都不能被改变。一个常量由英文字母、下划线、和数字组成,但 数字不能作为首字母出现。
在php中使用defaine()函数来定义常量,该函数的语法格式为:
define(string constant_name, mixed value, case_sensitive = true)
该函数有3个参数:
cons ......