Example usage for com.amazonaws.services.simpleemail.model Content setCharset

List of usage examples for com.amazonaws.services.simpleemail.model Content setCharset

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleemail.model Content setCharset.

Prototype


public void setCharset(String charset) 

Source Link

Document

The character set of the content.

Usage

From source file:com.irurueta.server.commons.email.AWSTextEmailMessage.java

License:Apache License

/**
 * Builds email content to be sent using an email sender.
 * @param message instance where content must be set.
 * @throws EmailException if setting mail content fails.
 *//*from   w  ww .  j  a  v  a2 s .  c  o  m*/
@Override
protected void buildContent(Message message) throws EmailException {
    Destination destination = new Destination(getTo());
    if (getBCC() != null && !getBCC().isEmpty()) {
        destination.setBccAddresses(getBCC());
    }
    if (getCC() != null && !getCC().isEmpty()) {
        destination.setCcAddresses(getCC());
    }

    if (getSubject() != null) {
        Content subject = new Content(getSubject());
        //set utf-8 enconding to support all languages
        subject.setCharset("UTF-8");
        message.setSubject(subject);
    }

    if (getText() != null) {
        Body body = new Body();
        Content content = new Content(getText());
        //set utf-8 enconding to support all languages            
        content.setCharset("UTF-8");

        body.setText(content);
        message.setBody(body);
    }
}