public class MailSessionProducer {
@Resource(lookup = "java:jboss/mail/greenmail")
private Session mailSession;
@Produces
@Named
public Session getMailSession() {
return mailSession;
}
}
public class MailSessionProducer {
@Resource(lookup = "java:jboss/mail/greenmail")
private Session mailSession;
@Produces
@Named
public Session getMailSession() {
return mailSession;
}
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
public class MailRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:start")
.to("smtps://smtp.gmail.com?session=#mailSession");
}
}
public class MailRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:start")
.to("smtps://smtp.gmail.com?session=#mailSession");
}
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
Map<String, Object> headers = new HashMap<String, Object>();
headers.put("To", "destination@test.com");
headers.put("From", "sender@example.com");
headers.put("Subject", "Camel on Wildfly rocks");
String body = "Hi,\n\nCamel on Wildfly rocks!.";
ProducerTemplate template = camelContext.createProducerTemplate();
template.sendBodyAndHeaders("direct:start", body, headers);
Map<String, Object> headers = new HashMap<String, Object>();
headers.put("To", "destination@test.com");
headers.put("From", "sender@example.com");
headers.put("Subject", "Camel on Wildfly rocks");
String body = "Hi,\n\nCamel on Wildfly rocks!.";
ProducerTemplate template = camelContext.createProducerTemplate();
template.sendBodyAndHeaders("direct:start", body, headers);
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow