smtpserver.java

来自「Jodd是一个开源的公用Java基础类库」· Java 代码 · 共 101 行

JAVA
101
字号
package jodd.mail;

/**
 * Represents single SMTP server for sending emails.
 *
 * This is part of Jodd.
 *
 * @2do default enoding and the rest params
 * @2do join with POP3?
 */
public class SmtpServer {

	// ---------------------------------------------------------------- construct

	/**
	 * SmtpServer default constructor.
	 */
	public SmtpServer() {
	}

	/**
	 * SMTP server defined with its host.
	 *
	 * @param host   SMTP host address
	 */
	public SmtpServer(String host) {
		this.host = host;
	}

	/**
	 * SMTP server defined with its host and authenitification.
	 *
	 * @param host   SMTP host address
	 */
	public SmtpServer(String host, String username, String password) {
		this.host = host;
		this.username = username;
		this.password = password;
	}

	// ---------------------------------------------------------------- data

	private String host;
	/**
	 * Sets SMTP host address.
	 *
	 * @param host   SMTP host address
	 */
	public void setHost(String host) {
		this.host = host;
	}
	/**
	 * Returns SMTP host address.
	 *
	 * @return SMTP host address
	 */
	public String getHost() {
		return host;
	}


	private String username;
	/**
	 * Sets SMTP authentication username. If username is not set, no
	 * authentification is needed.
	 *
	 * @param username Sets SMTP authentication username.
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	/**
	 * Returns SMTP authentification username
	 *
	 * @return authentification SMTP username
	 */
	public String getUsername() {
		return username;
	}
	

	private String password;
	/**
	 * Sets SMTP authentication password.
	 *
	 * @param password SMTP authentication password
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	/**
	 * Returns SMTP authentication password.
	 *
	 * @return SMTP authentication password
	 */
	public String getPassword() {
		return password;
	}

}

⌨️ 快捷键说明

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