How to attach image from drawable to gmail?

Here is the working code which you need: Firstly save image from Drawable to SD Card here is the code: try{ Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_green); //replace “R.drawable.bubble_green” with the image resource you want to share from drawable ByteArrayOutputStream bytes = new ByteArrayOutputStream(); largeIcon.compress(Bitmap.CompressFormat.JPEG, 40, bytes); // you can create a new file name “test.jpg” … Read more

Python IMAP search using a subject encoded with utf-8

import imaplib import getpass email = “[email protected]” sock = imaplib.IMAP4_SSL(“imap.gmail.com”, 993) sock.login(email, getpass.getpass()) # select the correct mailbox… sock.select() # turn on debugging if you like sock.debug = 4 then: # use the undocumented IMAP4.literal attribute sock.literal = “réception” sock.uid(‘SEARCH’, ‘CHARSET’, ‘UTF-8’, ‘SUBJECT’)

Rails attachments inline are not shown correctly in gmail

After all i found a solution: all you need to do is set the mime-type and encoding of the attachment. attachments.inline[‘blank’] = { :data => File.read(“#{Rails.root.to_s + ‘/app/assets/images/blank_500x500.png’}”), :mime_type => “image/png”, :encoding => “base64” } attachments.inline[‘discount-deal-triangle’] = { :data => File.read(“#{Rails.root.to_s + ‘/app/assets/images/discount-deal-triangle.png’}”), :mime_type => “image/png”, :encoding => “base64” } That did the trick for … Read more

My Java program stopped sending emails using my gmail Account

The key error is this: Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target See this JavaMail FAQ entry. Since you’re connecting to Gmail, this shouldn’t happen. The most likely causes are: There’s a firewall or anti-virus program intercepting your request. There’s something wrong in your JDK installation preventing it from finding … Read more

Download attachments from Gmail using Gmail API

Expanding @Eric answer, I wrote the following corrected version of GetAttachments function from the docs: # based on Python example from # https://developers.google.com/gmail/api/v1/reference/users/messages/attachments/get # which is licensed under Apache 2.0 License import base64 from apiclient import errors def GetAttachments(service, user_id, msg_id): “””Get and store attachment from Message with given id. :param service: Authorized Gmail API … Read more

How do I get around HttpError 403 Insufficient Permission? (gmail api, python)

Even though the accepted answer is 100% correct. I think it’s worth pointing out that why that’s the case. When you authorize a gmail service client, you can specify several different scopes: All, compose, labels, etc… These are all listed here: https://developers.google.com/gmail/api/auth/scopes The scope mentioned in the answer provides complete gmail access.