php群发邮件
简介:这是php群发邮件的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=325740' scrolling='no'> 发过邮件的人都知道,从别人那里申请的邮箱,没法群发。有些人说QQ不是群发吗?对是可以,但只能一次性发30个以内!发多了QQ邮箱就发不出去了!再说也没有法自定义邮箱格式!下面说一下传统群发邮件方法!你如果不会写 php程序你可以选择用群发软件!在这里我们先只讲 php程序!如下:
mail.class.php地址:http://www.123lianjie.com/mail.class.txt
include("mail.class.php");
$scontent = date("Y-m-d H-i-s");
##########################################
$smtpserver = "smtp.tom.com";//SMTP 服务器
$smtpserverport =25;//SMTP 服务器端口
$smtpusermail = "c@tom.com";//SMTP服务器的用户邮箱
$smtpemailto = "e421083458@163.com";//发送给谁
$smtpuser = "c";//SMTP服务器的用户帐号
$smtppass = "3780292";//SMTP服务器的用户密码
$mailsubject = "感恩2009,相约2010,导购泉城祝您元旦快乐";//邮件主题
$mailbody = $scontent;//邮件内容
$mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件
##########################################
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.
$smtp->debug = false;//是否显示发送的调试信息
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
?>
如果你用这种方法发的邮件过多!smtp服务器就有可能把你暂时屏蔽!这时你就无法发出邮件了!怎么避免这种问题呢?自己架势mail服务器就没问题了!
在这里我们的用WinWebMail 3.7.7.3来架设mail服务器!建议把所有限制全部√去!这样mail服务器就能得最大限度的应用!
找出自己的多个域名!分别做一个二级域名指向你的mail服务器IP!然后再再你的mail服务器上绑定上域名!然后用以上多个域名分别注册多个账号!这样子你就不只是一个smtp服务器了!是多个!adsl用户IP绑定问题大家都会吧!用路由做一个映射!就可以了!测试服务器是否能够正常使用!
如果没有问题了!我们就来写php群发程序了!
我们要先想几个问题!1.不要发邮件过快,10s可以吧!2.能按数组来发邮件这样方便加的入邮箱列表!3.轮流使用不同的发信地址来发送邮件!具体大家看程序吧!
include("mail.class.php");
session_start();
$email_arr = explode("|","421083458@qq.com");
//print_r($email_arr);
if(!isset($_SESSION['e']))
$_SESSION['e'] = 0;
if($_SESSION['e']>=count($email_arr))
die("全部邮件发送完毕!");
$e = $_SESSION['e'];
$_SESSION['e'] = $_SESSION['e']+1 ;
echo $e;
date_default_timezone_set('PRC');
$scontent = date("Y-m-d H-i-s");
$domain = array(
"0"=>array("0"=>"k@mail.kemeishuma.com","1"=>"k","2"=>"3780292"),
"1"=>array("0"=>"p@mail.penghuaji.org","1"=>"p","2"=>"3780292"),
"2"=>array("0"=>"s@mail.smileshoping.cn","1"=>"s","2"=>"3780292"),
"3"=>array("0"=>"1@mail.123lianjie.com","1"=>"1","2"=>"3780292"),
"4"=>array("0"=>"c@mail.chunshuiji.org","1"=>"c","2"=>"3780292"),
);
if(!isset($_SESSION['i'])||$_SESSION['i']>4)
$_SESSION['i'] = 0;
$i = $_SESSION['i'];
$_SESSION['i'] = $_SESSION['i']+1 ;
##########################################
$smtpserver = "mail.chunshuiji.org";//SMTP服务器
$smtpserverport =25;//SMTP服务器端口
$smtpusermail = $domain[$i][0];//SMTP服务器的用户邮箱
$smtpemailto = $email_arr[$e];//发送给谁
$smtpuser = $domain[$i][1];//SMTP服务器的用户帐号
$smtppass = $domain[$i][2];//SMTP服务器的用户密码
$mailsubject = "感恩2009,相约2010,导购泉城祝您元旦快乐";//邮件主题
$mailbody = $scontent;//邮件内容
$mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件
##########################################
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.
$smtp->debug = true;//是否显示发送的调试信息
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
?>
<script> <br />function gonext() <br />{ <br />setTimeout("location.href='sentmail.php?id=<?php echo $email_arr[$e]?>'",10000); <br />} <br /></script>
用户邮件发送成功!
<script>gonext()</script>
“php群发邮件”的更多相关文章 》
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/325740.html pageNo:13
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











There are four main error types in PHP: 1.Notice: the slightest, will not interrupt the program, such as accessing undefined variables; 2. Warning: serious than Notice, will not terminate the program, such as containing no files; 3. FatalError: the most serious, will terminate the program, such as calling no function; 4. ParseError: syntax error, will prevent the program from being executed, such as forgetting to add the end tag.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

HTTP request methods include GET, POST, PUT and DELETE, which are used to obtain, submit, update and delete resources respectively. 1. The GET method is used to obtain resources and is suitable for read operations. 2. The POST method is used to submit data and is often used to create new resources. 3. The PUT method is used to update resources and is suitable for complete updates. 4. The DELETE method is used to delete resources and is suitable for deletion operations.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

In PHPOOP, self:: refers to the current class, parent:: refers to the parent class, static:: is used for late static binding. 1.self:: is used for static method and constant calls, but does not support late static binding. 2.parent:: is used for subclasses to call parent class methods, and private methods cannot be accessed. 3.static:: supports late static binding, suitable for inheritance and polymorphism, but may affect the readability of the code.

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.
