【JavaWeb项目】一个众筹网站的开发(九)邮件开发
Java官方支持邮件开发,Javax-mail
jdk中默认没有,需要另外下载
apache的基于Javax-mail开发了commons-mail,更加简单高效,推荐使用
一、电子邮件接收和发送协议
二、Apache-James邮件服务器
1.自己搭建
1)将压缩包解压到非中文无空格路径
2)解决jar包冲突
3)操作一些命令设置服务器
设置服务器的域名,给服务器设置用户名和密码
其实james服务器也是将所有数据存在数据库中,默认自带的
可以让james保存到mysql中
mysql驱动的jar放入conf的lib下 James安装目录下的lib是默认的jar,conf中的lib是自定义的jar
打开james-database-template.properties配置,并改名为james-database.properties
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# This template file can be used as example for James Server configuration
# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
# See http://james.apache.org/server/3/config.html for usage
# Use derby as default
database.driverClassName=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/email
database.username=root
database.password=root
# Supported adapters are:
# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
vendorAdapter.database=MYSQL
# Use streaming for Blobs
# This is only supported on a limited set of databases atm. You should check if its supported by your DB before enable
# it.
#
# See:
# http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html #7.11. LOB Streaming
#
openjpa.streaming=false
邮箱账户@邮箱地址
james需要配置域名(端口默认为9999)
打开一个新的命令窗口
通过DOS窗口,进入到james服务器的bin文件目录, 然后执行下面的DOS命令
创建邮箱的域名
james-cli.bat -h localhost -p 9999 adddomain atguigu.com
创建邮箱用户
james-cli.bat -h localhost -p 9999 adduser test@atguigu.com test
james-cli.bat -h localhost -p 9999 adduser admin@atguigu.com admin
配置foxmail客户端,测试邮件服务器
工具--->账号管理--->新建
三、后台其他
维护资质
资质:证件
t_cert表
分类管理
通过一个矩阵表格,维护每一类账户该上传哪些资质
t_account_type_cert 资质和分类的维护是这个中间表