X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkiss%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fnotification%2FMailServer.java;h=fd0bd2dfabeb6765967cab62071bc9508958864a;hb=921e31560ace4bd19e34757d0e974aadc1ba6b6a;hp=1fe66dde36b45438e3de41a94c6b90490d126da7;hpb=d85bc24e068a68a54786fae5dc71573607b3b0cb;p=utils diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/notification/MailServer.java b/crawler/kiss/src/org/wamblee/crawler/kiss/notification/MailServer.java index 1fe66dde..fd0bd2df 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/notification/MailServer.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/notification/MailServer.java @@ -1,6 +1,17 @@ -/** - * Copyright (c) 2005 UPS_SCS NL - * +/* + * Copyright 2006 the original author or authors. + * + * Licensed 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. */ package org.wamblee.crawler.kiss.notification; @@ -15,32 +26,44 @@ import org.apache.commons.mail.EmailException; * Mail server. */ public class MailServer { - - private String _host; + + private String _host; + private int _port; + private String _username; + private String _password; /** - * Constructs the mail server interface. - * @param aHost Host name of the SMTP server. - * @param aPort Port name of the SMTP server. - * @param aUsername Username to use for authentication or null if no authentication is - * required. - * @param aPassword Password to use for authentication or null if no authenticatio is - * required. + * Constructs the mail server. + * + * @param aHost + * Host name of the SMTP server. + * @param aPort + * Port name of the SMTP server. + * @param aUsername + * Username to use for authentication or null if no + * authentication is required. + * @param aPassword + * Password to use for authentication or null if no authenticatio + * is required. */ - public MailServer(String aHost, int aPort, String aUsername, String aPassword) { + public MailServer(String aHost, int aPort, String aUsername, + String aPassword) { _host = aHost; _port = aPort; _username = aUsername; _password = aPassword; } - + /** - * Sends an e-mail. - * @param aMail Mail to send. - * @throws EmailException In case of problems sending the mail. + * Sends an e-mail. + * + * @param aMail + * Mail to send. + * @throws EmailException + * In case of problems sending the mail. */ public void send(Email aMail) throws EmailException { Properties props = new Properties(); @@ -48,7 +71,8 @@ public class MailServer { props.put("mail.smtp.host", _host); props.put("mail.smtp.port", "" + _port); - Session mailSession = Session.getInstance(props, new UsernamePasswordAuthenticator(_username, _password)); + Session mailSession = Session.getInstance(props, + new UsernamePasswordAuthenticator(_username, _password)); aMail.setMailSession(mailSession); aMail.send(); }