Search in sources :

Example 1 with EmailAttachment

use of com.haulmont.cuba.core.global.EmailAttachment in project cuba by cuba-platform.

the class Emailer method sendTestEmail.

@Authenticated
@Override
public String sendTestEmail(String addresses) {
    try {
        String att = "<html><body><h1>Test attachment</h1></body></html>";
        EmailAttachment emailAtt = EmailAttachment.createTextAttachment(att, StandardCharsets.UTF_8.name(), "test attachment.html");
        emailer.sendEmail(addresses, "Test email", "<html><body><h1>Test email</h1></body></html>", emailAtt);
        return "Email to '" + addresses + "' sent successfully";
    } catch (Exception e) {
        return ExceptionUtils.getStackTrace(e);
    }
}
Also used : EmailAttachment(com.haulmont.cuba.core.global.EmailAttachment) Authenticated(com.haulmont.cuba.security.app.Authenticated)

Aggregations

EmailAttachment (com.haulmont.cuba.core.global.EmailAttachment)1 Authenticated (com.haulmont.cuba.security.app.Authenticated)1