mailsender.java.svn-base

来自「javamail使用例子」· SVN-BASE 代码 · 共 102 行

SVN-BASE
102
字号
package com.gsta.bimp.modules.mail;

import com.gsta.bnet.ecommerce.util.StringUtil;

/**
 * Title:MailSender.java<br>
 * Description: 邮件发送者<br>
 * Date:2008-3-4<br>
 * 
 * @author :dengwenguang<br>
 * @version 1.0<br>
 */
public class MailSender {
	private String smtpHost;

	private String fromAddress;

	private boolean isAuthentication = true;

	private String userName;

	private String password;

	/**
	 * @return the fromAddress
	 */
	public String getFromAddress() {
		return fromAddress;
	}

	/**
	 * @param fromAddress
	 *            the fromAddress to set
	 */
	public void setFromAddress(String fromAddress) {
		this.fromAddress = fromAddress;
	}

	public boolean getIsAuthentication() {
		return isAuthentication;
	}

	public void setIsAuthentication(boolean isAuthentication) {
		this.isAuthentication = isAuthentication;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		if (isAuthentication && !StringUtil.chkNull(password)) {
			throw new NullPointerException();
		}
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the smtpHost
	 */
	public String getSmtpHost() {
		if (!StringUtil.chkNull(smtpHost)) {
			throw new NullPointerException();
		}
		return smtpHost;
	}

	/**
	 * @param smtpHost
	 *            the smtpHost to set
	 */
	public void setSmtpHost(String smtpHost) {
		this.smtpHost = smtpHost;
	}

	/**
	 * @return the userName
	 */
	public String getUserName() {
		if (isAuthentication && !StringUtil.chkNull(userName)) {
			throw new NullPointerException();
		}
		return userName;
	}

	/**
	 * @param userName
	 *            the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?