gmail-imap

Python: Imaplib error

隐身守侯 提交于 2019-12-12 06:17:33
问题 import serial import imaplib from time import sleep IMAP_SERVER='imap.gmail.com' IMAP_PORT=993 ser= serial.Serial ('/dev/ttyACM0',9600) while True: M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT) rc, resp = M.login('user@gmail.com', 'Password') print rc, resp M.select() for msg_num in M.search("INBOX", "UNDELETED")[1][0].split(): msg = M.fetch('1', '(BODY.PEEK[TEXT])') try: String = msg[1][0][1][139:148] except TypeError: continue print String if String == "This is just a test...": ser.write('0

Python IMAPClient/imaplib search unicode issue

﹥>﹥吖頭↗ 提交于 2019-12-12 04:35:49
问题 I'm using the IMAPClient library, but I'm getting UnicodeEncodeError when doing a search. Below is a snippet and the stack trace: imap_client = imapclient.IMAPClient('imap.gmail.com', use_uid=True, ssl=True) imap_client.oauth2_login('john@example.com', 'xxx') subject = u'Test \u0153\u2211\u00b4\u00e5\u00df\u2202' from_email = u'john@example.com' to_emails = [u'foo@example.com'] cc_emails = [] approx_date_sent = '05-Aug-2013' imap_client.select_folder(r'\Sent') search_criteria = [ u'FROM %s' %

Not able to send mails to gmail account using javamail api

假如想象 提交于 2019-12-12 03:19:33
问题 When I am trying to send a sample mail to gmail account, am getting com.sun.mail.smtp.SMTPAddressFailedException. Following is the code i have written... Please can somebody help me to resolve the issue? public class MultiMimes { public static void main(String[] args) throws Exception{ Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "mailservername"); props.put("mail.debug", "true"); Session session = Session.getDefaultInstance(props,null); Message message = new

get Sent mail using IMAP

六眼飞鱼酱① 提交于 2019-12-12 01:21:37
问题 I'm trying to fetch my sent mail using IMAP in C# but even after a considerable amount of time, i've not been able to make it work. The output given to me is null even when 12 emails are fetched. Consider the following screenshot The only help/hint i got on stackoverflow is this: get sent mails via imap [UPDATE] This is my code: > ImapClient client = new ImapClient("ExampleHost", port, ssl); > try > { > client.Login("ExampleEmail", "ExamplePass", AuthMethod.Login); > IEnumerable<uint> units =

IMAP Client Sync local messages Server?

不想你离开。 提交于 2019-12-11 19:29:26
问题 What's the best general technique for creating an IMAP client and keeping its local message store in sync with the server? I guess I'm looking for the right way to figure out what's changed in an IMAP folder on the server since the last time I checked, and download those changes, to persist them to my local database... This would include messages no longer in the folder (deleted or moved), new messages, and changed messages... I guess new messages is easy, I can grab the highest UID i have

libcurl imaps doesn't returns Header Field “Content-Transfer-Encoding” or “Content-Type”

懵懂的女人 提交于 2019-12-11 18:26:27
问题 I have been trying to detect encoding of an email manually, to see whether the email that i have just fetched needed to be base64 decoded or not, but that wasn't a complete solution. So now I'm trying to download the headers (fields) of an email first, check them what kind of email it is and then proceed to decoding it with base64 in case the header says that it is a base64 encoded email or just skip it if it is a plain text or HTML text. The problem is that the libcurl commands for fetching

Problems with JavaMail, GMail and OAUTH2 (not Android)

懵懂的女人 提交于 2019-12-11 12:54:39
问题 I'm having a problem connecting to GMail with JavaMail in a non-android environment. I'm being given an OAuth2 access token, which I believe to be correct. But when I try to use this access token to connect, I get an exception: javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure) It looks, to me, like the Java SASL code is expecting two return values (a username and a password callback?), but is only getting one. I've boiled the problem down to this

Python imaplib download Gmail Text without downloading the full attachment

本秂侑毒 提交于 2019-12-11 11:24:50
问题 I am using 'imaplib' in python to fetch the email from a Gmail account. But I just want to know the content of the email, the title of the attachment, but do not need to download the full attachment. By default, myGmail = imaplib.IMAP4_SSL(...) .... (respCode, data) = myGmail.fetch(mailUid, 'RFC822') will return the whole part of email, including the whole attachment encoded as text in the return data, which is sometimes huge and unnecessary. I've searched over the internet and stackOverflow

Delete message from Gmail “All Mail” folder via IMAP

浪子不回头ぞ 提交于 2019-12-11 08:38:58
问题 I am accessing Gmail All Mail folder via imap, using RFC 3501. I need to delete a message (Move to Trash or Permanently delete) from the folder. The following commands do not seem to work: UID STORE 123 +FLAGS (\Deleted) EXPUNGE I can modify labels using X-GM-LABELS, but there is no option to add a "Trash" label. The RFC 3501, does not have a "MOVE" command, so I need to copy the message to "Trash" folder and then remove it from the parent folder. What's the way out?? Thanks. Found partial

Retrieve html using imap_fetchbody

感情迁移 提交于 2019-12-11 06:16:52
问题 i am using imap to retrieve emails. It works fine for fine for plain text. But problem getting html, I use imap_fetchbody($connections,$email_number,1.2); but it does not work. It returns null. But if I try imap_fetchbody($connections,$email_number,1.1); which is for plain text I get * instead of html tag. I appreciate any help 回答1: As per PHP specifications string imap_fetchbody ( resource $imap_stream , int $msg_number , string $section [, int $options = 0 ] ) Just Remember that the number