PHP通过SMTP实现发送邮件

  • H5_322842
    了解作者
  • 27.8KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-12 08:49
    上传日期
这个是PHP通过SMTP发送邮件类,很好用的。配置好邮件服务器的相关信息,即可成功发送邮件。已经通过测试,可以试下。
phpmailer邮件发送示例.rar
  • phpmailer邮件发送示例
  • class.smtp.php
    25KB
  • class.phpmailer.php
    72.8KB
  • 888.php
    3.4KB
  • class.pop3.php
    10.4KB
内容介绍
<?php /*~ class.phpmailer.php .---------------------------------------------------------------------------. | Software: PHPMailer - PHP email class | | Version: 5.1 | | Contact: via sourceforge.net support pages (also www.worxware.com) | | Info: http://phpmailer.sourceforge.net | | Support: http://sourceforge.net/projects/phpmailer/ | | ------------------------------------------------------------------------- | | Admin: Andy Prevost (project admininistrator) | | Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net | | : Marcus Bointon (coolbru) coolbru@users.sourceforge.net | | Founder: Brent R. Matzelle (original founder) | | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | | Copyright (c) 2001-2003, Brent R. Matzelle | | ------------------------------------------------------------------------- | | License: Distributed under the Lesser General Public License (LGPL) | | http://www.gnu.org/copyleft/lesser.html | | This program is distributed in the hope that it will be useful - WITHOUT | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | | FITNESS FOR A PARTICULAR PURPOSE. | | ------------------------------------------------------------------------- | | We offer a number of paid services (www.worxware.com): | | - Web Hosting on highly optimized fast and secure servers | | - Technology Consulting | | - Oursourcing (highly qualified programmers and graphic designers) | '---------------------------------------------------------------------------' */ /** * PHPMailer - PHP email transport class * NOTE: Requires PHP version 5 or later * @package PHPMailer * @author Andy Prevost * @author Marcus Bointon * @copyright 2004 - 2009 Andy Prevost * @version $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License */ if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n"); class PHPMailer { ///////////////////////////////////////////////// // PROPERTIES, PUBLIC ///////////////////////////////////////////////// /** * Email priority (1 = High, 3 = Normal, 5 = low). * @var int */ public $Priority = 3; /** * Sets the CharSet of the message. * @var string */ public $CharSet = 'iso-8859-1'; /** * Sets the Content-type of the message. * @var string */ public $ContentType = 'text/plain'; /** * Sets the Encoding of the message. Options for this are * "8bit", "7bit", "binary", "base64", and "quoted-printable". * @var string */ public $Encoding = '8bit'; /** * Holds the most recent mailer error message. * @var string */ public $ErrorInfo = ''; /** * Sets the From email address for the message. * @var string */ public $From = 'root@localhost'; /** * Sets the From name of the message. * @var string */ public $FromName = 'Root User'; /** * Sets the Sender email (Return-Path) of the message. If not empty, * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. * @var string */ public $Sender = ''; /** * Sets the Subject of the message. * @var string */ public $Subject = ''; /** * Sets the Body of the message. This can be either an HTML or text body. * If HTML then run IsHTML(true). * @var string */ public $Body = ''; /** * Sets the text-only body of the message. This automatically sets the * email to multipart/alternative. This body can be read by mail * clients that do not have HTML email capability such as mutt. Clients * that can read HTML will view the normal Body. * @var string */ public $AltBody = ''; /** * Sets word wrapping on the body of the message to a given number of * characters. * @var int */ public $WordWrap = 0; /** * Method to send mail: ("mail", "sendmail", or "smtp"). * @var string */ public $Mailer = 'mail'; /** * Sets the path of the sendmail program. * @var string */ public $Sendmail = '/usr/sbin/sendmail'; /** * Path to PHPMailer plugins. Useful if the SMTP class * is in a different directory than the PHP include path. * @var string */ public $PluginDir = ''; /** * Sets the email address that a reading confirmation will be sent. * @var string */ public $ConfirmReadingTo = ''; /** * Sets the hostname to use in Message-Id and Received headers * and as default HELO string. If empty, the value returned * by SERVER_NAME is used or 'localhost.localdomain'. * @var string */ public $Hostname = ''; /** * Sets the message ID to be used in the Message-Id header. * If empty, a unique id will be generated. * @var string */ public $MessageID = ''; ///////////////////////////////////////////////// // PROPERTIES FOR SMTP ///////////////////////////////////////////////// /** * Sets the SMTP hosts. All hosts must be separated by a * semicolon. You can also specify a different port * for each host by using this format: [hostname:port] * (e.g. "smtp1.example.com:25;smtp2.example.com"). * Hosts will be tried in order. * @var string */ public $Host = 'localhost'; /** * Sets the default SMTP server port. * @var int */ public $Port = 25; /** * Sets the SMTP HELO of the message (Default is $Hostname). * @var string */ public $Helo = ''; /** * Sets connection prefix. * Options are "", "ssl" or "tls" * @var string */ public $SMTPSecure = ''; /** * Sets SMTP authentication. Utilizes the Username and Password variables. * @var bool */ public $SMTPAuth = false; /** * Sets SMTP username. * @var string */ public $Username = ''; /** * Sets SMTP password. * @var string */ public $Password = ''; /** * Sets the SMTP server timeout in seconds. * This function will not work with the win32 version. * @var int */ public $Timeout = 10; /** * Sets SMTP class debugging on or off. * @var bool */ public $SMTPDebug = false; /** * Prevents the SMTP connection from being closed after each mail * sending. If this is set to true then to close the connection * requires an explicit call to SmtpClose(). * @var bool */ public $SMTPKeepAlive = false; /** * Provides the ability to have the TO field process individual * emails, instead of sending to entire TO addresses * @var bool */ public $SingleTo = false; /** * If SingleTo is true, this provides the array to hold the email addresses * @var bool */ public $SingleToArray = array(); /** * Provides the ability to change the line ending * @var string */ public $LE = "\n"; /** * Used with DKIM DNS Resource Record * @var string */ public $DKIM_selector = 'phpmailer'; /** * Used with DKIM DNS Resource Record * optional, in format of email address 'you@yourdomain.com' * @var string */ public $DKIM_identity = ''; /** * Used with DKIM DNS Resource Record * optional, in format of email address 'you@yourdomain.com' * @var string */ public $DKIM_domain = ''; /** * Used with DKIM
评论
    相关推荐
    • PHP 简易服务器
      PHP简易服务器PHP简易服务器PHP简易服务器PHP简易服务器PHP简易服务器
    • 无敌服务器php配置文件
      无敌服务器php配置文件| 无敌服务器php配置文件
    • wifidog认证服务器php脚本
      php编写的wifidog认证服务器脚本,主要实现了用户的登录校验和认证授权。
    • phoenix:HTTP服务器PHP扩展
      phoenix是用于PHP扩展的HTTP服务器 <?php function work_cb ( PhxClient $ client ) { $ name = $ client -> getUriArg ( 'name' ); $ client -> status ( 200 ); $ client -> sendHeader ( "connection: ...
    • php代理服务器 php反代 网页代理
      将upload文件夹下文件放到你的服务器上 这样就可以通过你的服务器访问网页了 很好用 也可以用于简单的 甚至是进入局域网
    • 易语言PHP服务器
      易语言PHP服务器源码,PHP服务器,监听服务,编码转换程序,进制转换,取页面地址,取域名,取端口,取指定内容中间,取文本之间,取文本之后,ChrW,十到十六,到十六进制文本,去除首部零,URL编码_UTF8,Ansi转Utf8,Unicode转Utf8...
    • window2003服务器php环境配置
      此文件包含了文档和文件,一条龙服务,绝对一次成功
    • 服务器php环境搭建(phpwamp服务器集成环境下载)
      服务器php环境搭建(phpwamp服务器集成环境下载)
    • 易语言PHP服务器
      易语言PHP服务器源码系统结构:监听服务,编码转换程序,进制转换,取页面地址,取域名,取端口,取指定内容中间,取文本之间,取文本之后,ChrW,十到十六,到十六进制文本,去除首部零,URL编码
    • 服务器php环境安装
      linux服务器快速搭建编译的lamp环境步骤;多年经验得来。值得拥有,搭建环境就是这么简单