php之pdo邮箱注册

一,创建用户邮箱注册表 

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);


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值