Git Product home page Git Product logo

phpmailer-swoole's Introduction

PHPMailer-Swoole

Latest Version Php Version Swoole Version IMI License

介绍

这是一个适合用于 Swoole 协程环境下的 PHPMailer。

基于 PHPMailer 6.0 实现 PHPMailer 的 Swoole 协程环境支持,本项目未修改 PHPMailer 源码,理论上兼容 PHPMailer 6.0 及后续版本。

只需要使用 Composer 引入了本项目,PHPMailer 将会自动支持协程化,并且只能运行在 Swoole 协程中!

QQ群:17916227 点击加群

使用说明

Composer:"yurunsoft/phpmailer-swoole":"~1.0"

使用方式和 PHPMailer 并无两样,唯一需要注意的是只支持在 Swoole 协程下运行。

go(function(){
	$mail = new PHPMailer; //PHPMailer对象
	$mail->CharSet = 'UTF-8'; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
	$mail->IsSMTP(); // 设定使用SMTP服务
	$mail->SMTPDebug = 0; // 关闭SMTP调试功能
	$mail->SMTPAuth = true; // 启用 SMTP 验证功能
	$mail->SMTPSecure = 'ssl'; // 使用安全协议
	$mail->Host = 'smtp.163.com'; // SMTP 服务器
	$mail->Port = '994'; // SMTP服务器的端口号
	$mail->Username = ''; // SMTP服务器用户名
	$mail->Password = ''; // SMTP服务器密码
	$mail->SetFrom('', ''); // 邮箱,昵称
	$mail->Subject = 'title test';
	$mail->MsgHTML('hello world');
	$mail->AddAddress(''); // 收件人
	$result = $mail->Send();
	if($result)
	{
		var_dump('ok');
	}
	else
	{
		$result = $error = $mail->ErrorInfo;
		var_dump($result);
	}
});

更加详细的示例代码请看test目录下代码。

phpmailer-swoole's People

Contributors

wuwu123 avatar yurunsoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

phpmailer-swoole's Issues

don't work

Helllo,
Setup PHPMailer-Swoole, copy test.php.
But have error:
PHP Fatal error: Uncaught Error: Call to undefined function go() in /user/temp/vendor/zzz.php:4
Stack trace:
#0 {main}
thrown in /user/temp/vendor/zzz.php on line 4

concurrent 多个时

PHP Fatal error: Uncaught Swoole\Error: Socket#54 has already been bound to another coroutine#6, reading of the same socket in coroutine#5 at the same time is not allowed in /opt/www/vendor/yurunsoft/phpmailer-swoole/src/PHPMailer/functions.php:134

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.