- 论坛徽章:
- 0
|
说实在的igenus开的很烂。作者没有OOP概念。
这个贴子.是很久以前发的.
开发 webmail 已经没有意义了..网上太多的版本了.如果不喜欢可以使用
mail API 自己开发.如 javamail api
目前如果想搞邮件服务器.就入反拉圾,病毒,过滤,SSL加密,数字签名...入手..
还有就是写mail 与传真,短信集成..
这些也都不是难事...
我已经一年没搞邮件服务器.以后搞的机会更少..
- 如果你想开发.我给你点建议.
- 1, 要考虑多国语言问题.即使用语言包技术.编码采用UNICODE,如下..
- import java.util.*;
- public class Hello {
-
- public Hello() {
- // TODO: Add your code here
- }
- public static void main(String[] args) {
- Locale locale;
- ResourceBundle messages;
-
- System.out.println("English:");
- locale = new Locale("en", "US");
- messages = ResourceBundle.getBundle("Hello", locale);
- System.out.println(messages.getString("GREETINGS"));
-
-
- System.out.println("Chinese:");
- locale = new Locale("zh", "CN");
- messages = ResourceBundle.getBundle("Hello", locale);
- System.out.println(messages.getString("chen->;GREETINGS"));
- }
- }
- /*
- HELLO.properties
- GREETINGS=HELLO
- HELLO_en_US.properties
- GREETINGS=HELLO
- HELLO_zh_CN.properties
- GREETINGS=你好
- */
复制代码
- 2,各种认证模块
- 如,md5,crypt,sha1, cleartext......
- 这个可以使用JAVA中的.Properties 详细使用方法如下.
- package netkiller;
- import java.io.*;
- import java.util.*;
- public class Initializers {
- private String init = null;
- private Properties props = new Properties();
- public Initializers() {
- this.init = "netkiller.properties";
- this.load(init);
- }
- public Initializers(String init) {
- this.init = init;
- this.load(init);
- }
-
- public String getProperty(String value){
- return props.getProperty(value);
- }
- public String getProperty(String value,String default_value){
- return props.getProperty(value,default_value);
- }
- public void setProperty(String key,String value){
- props.setProperty(key,value);
- }
- public void remove(String key){
- props.remove(key);
- }
- public void load(String file){
- try{
- FileInputStream fis = new FileInputStream(file);
- props.load(fis);
- fis.close();
- }
- catch(java.io.FileNotFoundException e){
- System.out.println(e.toString());
- }
- catch(IOException e){
- System.out.println(e.toString());
- }
- }
- public void store(){
- try{
- FileOutputStream fos = new FileOutputStream(this.init);
- props.store(fos,"netkiller (netkiller@9812.net) http://www.9812.net");
- fos.close();
- }
- catch(java.io.FileNotFoundException e){
- System.out.println(e.toString());
- }
- catch(IOException e){
- System.out.println(e.toString());
- }
- }
- public boolean createNewFile(String filename){
- boolean isSuccessful = false;
- try{
- File file = new File(filename);
- file.createNewFile();
- isSuccessful = true;
- }
- catch(Exception e){
- System.err.println(e.toString());
- }
- return isSuccessful;
- }
- public static void main(String[] args) {
- //Initializers test = new Initializers();
-
- Properties props = new Properties();
- //System.out.println(test.getProperty("name"));
-
- try{
- // You can also load properties from a file
- FileInputStream fis = new FileInputStream("netkiller.properties");
- props.load(fis);
- // getProperty will return the value if found, otherwise null
- //System.out.println(props.getProperty("db.user"));
- // getProperty will return the value if found, otherwise "none"
- //System.out.println(props.getProperty("db.password", "none"));
- Enumeration enum = props.propertyNames();
- while(enum.hasMoreElements()){
- String key = (String)enum.nextElement();
- String value = props.getProperty(key);
- System.out.println(key+":"+value);
- }
- fis.close();
- FileOutputStream fos = new FileOutputStream("netkiller.properties");
- props.remove("db.user");
- props.remove("db.password");
- //props.put("db.user", "jack");
- //props.put("db.password", "opendoor");
- props.setProperty("card", "http://192.168.0.1:8080/gomine/includes/company.jsp?uid=");
- props.setProperty("home", "http://192.168.0.1:8080/gomine/");
- props.setProperty("email", "webmaster@gomine.com");
- props.setProperty("tel", "");
- props.setProperty("fax", "");
-
- //props.save(fos,"header");
- props.store(fos,"netkiller (陈景峰) http://www.9812.net");
- fos.close();
- }
- catch(java.io.FileNotFoundException e){
- System.out.println(e.toString());
- }
- catch(IOException e){
- System.out.println(e.toString());
- }
-
- }
- }
复制代码
- 3,要考虑不同平台.所邮件系统.
- 同时支持postfix,qmail....
- 4, 备份,恢复方案
- 5,可以使用插件技术.这样更容易扩展.
- 6,开发注意写文档.并定义标准API.如
- getMailSubject()
- getMailFrom()
- getMailTo()
- ....
- 不再举例..
- 总之.可以让你的用户调用你的API二次开发你的系统.
- 7,其它等想出来再给你说,哈哈:)
复制代码
开发webmail 基本就是3种实现方式,
1,读取物理磁盘文件,就是maildir
2, 使用pop/imap socket 实现
3,使用其它API[/quote] |
|