0
I have a system that sends e-mail, works normally, I want to insert a field to send copies of email, a CC or Cco. follows below an excerpt of my code.
Entity
private String destino;
private String titulo;
private String mensagem;
Sent method
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>
Ultilizada Library , Commons-email
Put in your question the email library you used, I believe it is apache Commons email
– Henrique Luiz