forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1980 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
19bc9b0725
commit
72d8868e4a
@ -1,8 +1,12 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,138 @@
|
|||||||
|
package pt.evolute;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.evolute.utils.mail.SendMail;
|
||||||
|
|
||||||
|
public class MailSenderSpringBean {
|
||||||
|
|
||||||
|
private SendMail mail;
|
||||||
|
|
||||||
|
private String host;
|
||||||
|
private Integer port;
|
||||||
|
private boolean secure;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String defaultFROM;
|
||||||
|
private String defaultTO;
|
||||||
|
|
||||||
|
public MailSenderSpringBean()
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getHost()
|
||||||
|
{
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host)
|
||||||
|
{
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPort()
|
||||||
|
{
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(Integer port)
|
||||||
|
{
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getSecure()
|
||||||
|
{
|
||||||
|
return secure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecure(Boolean secure)
|
||||||
|
{
|
||||||
|
this.secure = secure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername()
|
||||||
|
{
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username)
|
||||||
|
{
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword()
|
||||||
|
{
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password)
|
||||||
|
{
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultFROM()
|
||||||
|
{
|
||||||
|
return defaultFROM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultFROM(String defaultFROM)
|
||||||
|
{
|
||||||
|
this.defaultFROM = defaultFROM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultTO()
|
||||||
|
{
|
||||||
|
return defaultTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultTO(String defaultTO)
|
||||||
|
{
|
||||||
|
this.defaultTO = defaultTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mailConfig()
|
||||||
|
{
|
||||||
|
mail = new SendMail();
|
||||||
|
mail.setSMTP_HOST(host);
|
||||||
|
mail.setSMTP_PORT(port);
|
||||||
|
mail.setUseSMTPS(secure);
|
||||||
|
mail.setSMTP_USER(username);
|
||||||
|
mail.setSMTP_PASS(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public synchronized void sendEmail(String from, String to, String body, String subject, boolean html) throws Exception
|
||||||
|
{
|
||||||
|
if(mail == null)
|
||||||
|
{
|
||||||
|
mailConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(from == null)
|
||||||
|
{
|
||||||
|
mail.setEmailFrom(defaultFROM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mail.setEmailFrom(from);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(to == null)
|
||||||
|
{
|
||||||
|
mail.setEmailTo(defaultTO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mail.setEmailTo(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
mail.setIsHTML(html);
|
||||||
|
mail.setMsgText(body);
|
||||||
|
mail.setSubject(subject);
|
||||||
|
mail.sendMail( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue