CauCuKien CauCuKien -4 years ago 187
Android Question

How to set CC and sender name for android Gmail API?

From Google official website, this is a method to create a email before sending.

public static MimeMessage createEmail(String to,
String from,
String subject,
String bodyText)
throws MessagingException {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);

MimeMessage email = new MimeMessage(session);

email.setFrom(new InternetAddress(from));
new InternetAddress(to));
return email;

I can't find the API which I can set for CC email address and sender name.
I searched on internet and also can't find the answer. Please have a help on this.

Answer Source

Set recipients with the setter method

  message.addRecipient(RecipientType.BCC, new InternetAddress(to));
    message.addRecipient(RecipientType.CC, new InternetAddress(to));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download