一,创建用户邮箱注册表
DROP TABLE IF EXISTS `email_user`;
CREATE TABLE IF NOT EXISTS `email_user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(30) NOT NULL COMMENT '用户名',
`password` varchar(32) NOT NULL COMMENT '密码',
`email` varchar(32) NOT NULL COMMENT '邮箱',
`token` varchar(50) NOT NULL COMMENT 'token',
`token_exptime` int(10) NOT NULL COMMENT 'token有效期',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态:0-未激活;1-激活',
`regtime` int(10) NOT NULL COMMENT '注册时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='邮箱注册表';
二,实例:
三,swiftmailer 邮件发送相关介绍:
<?php
/**
* swiftmailer 邮件发送
*
* 官网:https://swiftmailer.symfony.com/docs/introduction.html
* 邮件下载:https://codeload.github.com/swiftmailer/swiftmailer/zip/master
*
* PHP 7.0 +
* 安装 composer require "swiftmailer/swiftmailer:^6.0"
*/
require_once '/path/to/vendor/autoload.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.example.org', 25))
->setUsername('your username')
->setPassword('your password');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);