<?php include_once 'MailSmtp.class.php'; $body = <<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir="ltr"> <head> <meta http-equiv="x-ua-compatible" content="ie=7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Editplus4PHP" /> <meta name="keywords" content="Editplus4PHP" /> <meta name="description" content="Editplus4PHP" /> <meta name="author" content="Leo" /> <title>Example | xHTML1.0</title> </head> <body> <p>你好 wangchao</p> <p><b>认证地址:</b><a href="http://sadjs.com">http://sadjs.com</a></p> </body> </html> EOT; //邮件发送 $subject = "测试邮件"; $smtp = new MailSmtp('smtp.163.com', 25, true, '3345191837', '10562782800'); $smtp->send_mail('*****@*****.**', '*****@*****.**', $subject, $body, "HTML");
<?php //测试是smtp发送邮件 //by indraw //2004/11/15 error_reporting(E_ERROR | E_WARNING | E_PARSE); require "MailSmtp.class.php"; //----------------------------------------------------------------------------- $smtpserver = "smtp.163.com"; //SMTP邮件服务器 $smtpserverport = 25; //SMTP端口号 $smtpusermail = "*****@*****.**"; //SMTP发送邮件地址 $smtpuser = "******"; $smtppass = "******"; //SMTP邮件密码 $smtpemailto = "*****@*****.**"; //目标邮件地址 $mailsubject = "Test Subject"; //邮件主题 $mailbody = "<h1>This is a test mail</h1>"; //邮件内容 $mailtype = "HTML"; //邮件发送方式(HTML/TXT) $smtp = new MailSmtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass); //这里面的一个true是表示使用身份验证,否则不使用身份验证. $smtp->show_debug = TRUE; //是否显示发送的调试信息 $smtp->send_mail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); //-------------------------------------------------------------------------------