I have a system that sends email, it works normally, I want to insert a field to send copy of the email, a CC or CCo. here's a snippet of my code below.
Entity
private String destino;
private String titulo;
private String mensagem;
Method sendsEmail
public static void enviaEmail(Ordens ordens) throws EmailException {
Email email = new SimpleEmail();
email = conectaEmail();
email.setSubject(ordens.getTitulo());
email.setMsg(ordens.getMensagem());
email.addTo(ordens.getDestino());
String resposta = email.send();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "E-mail enviado com sucesso para: " + ordens.getUsuario().getLogin(), "Informação"));
}
Front
<p:panel header="Envio de e-mail">
<h:panelGrid columns="2">
<h:outputText value="Para: "/>
<h:inputText value="#{ordensControle.ordens.destino}" size="48"/>
<h:outputText value="Título: "/>
<h:inputText value="#{ordensControle.ordens.titulo}" size="48"/>
<h:outputText value="Mensagem: "/>
<h:inputTextarea value="#{ordensControle.ordens.mensagem}" cols="88"
rows="10"/>
</h:panelGrid>
<p:commandButton value="Enviar e-mail" icon="ui-icon-mail-closed"
onclick="PF('statusDialog').show();" action="#
{ordensControle.enviaEmail()}" update="outputPanelMail"/>
</p:panel>
Library Used, commons-email