I've used code similar to this to add multiple attachments, which works well
Message m = new Message(sb.toString());
m.setMimeType(Message.MIME_TEXT);
m.getAttachments().put(filename1, "text/html");
m.getAttachments().put(filename2, "text/html");
Message.sendMessage(recipients, "subject", m);
I've just needed to add only one attachment, using the same code, and on
Android (only test) Gmail keeps saying it cannot attach the file:
Message m = new Message(sb.toString());
m.setMimeType(Message.MIME_TEXT);
m.getAttachments().put(filename1, "text/html");
Message.sendMessage(recipients, "subject", m);
I tried a whole bunch of things, thinking it was the file path, message
name or content - nothing worked, until I changed the code to:
Message m = new Message(sb.toString());
m.setMimeType(Message.MIME_TEXT);
m.setAttachment(filename1);
m.setAttachmentMimeType("text/html");
Message.sendMessage(recipients, "subject", m);
So it appears if you only have one attachment you shouldn't use
Message.getAttachments() - is that correct ?
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/302eb775-545e-4348-ac97-b38262456a4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.