Set internalDateSource in Gmail API message upload - google-apps

I'm trying to import messages from imap to Gmail via Gmail API v1. If I use the API call for insert, I can specify internalDateSource to dateHeader. With that setting the message will display the original sent date in Gmail, instead of the import date.
If I use the Gmail API Upload method, I don't see any option to specify the internalDateSource in the multipart message header. So Gmail will use the latest receive header, which is the import.
Received: from 661831859263-hlgnfsakj37rged896gvl0mitub85lii.apps.googleusercontent.com
named unknown
by gmailapi.google.com
with HTTPREST;
Wed, 4 Mar 2015 00:01:04 -0800
Any ideas how to display the original delivery or sent date in Gmail when uploading a message via upload request?

internalDateSource should be set as part of the URI, not a header:
https://www.googleapis.com/upload/gmail/v1/users/<userId>/messages?internalDateSource=dateHeader
also, be aware that messages.insert() does not de-duplicate mail nor does it do automatic threading. For migrating mail from another system, messages.import() is probably the better choice.
It's definitely worth reading through the Migrating from the Email Migration API page for some pointers.

Related

Why am I not able to view all the Headers of the mail on Exchange Server using JavaMail API?

I'm using JavaMail to read the mails in the mailbox on an Exchange Server. I used the concept of "Exchange Bridge" to access the mailbox. Using this concept, I'm able to get the count of the messages in the mailbox.
How ever, I'm not able to get the size of those mails(using getSize()). It always gives me 0 as the size.
Also, I used getAllHeaders() and iterated through the returned enum to get the name and values of the headers. But I was able to get only the following headers - Date, From, Subject
Why am I not able to see Message-ID, ReferenceID, In-Reply-To and other headers?
What exactly do you mean by "Exchange Bridge"? Is this a separate server that sits between your JavaMail client and your Exchange server, perhaps translating IMAP or POP3 requests into MAPI requests? If so, it's probably not doing a perfect job of translating, thus these gaps.

SES: Delivery Status Notification (Failure)

I use Amazon SES to delivery mail to mobile devide Japanese such as ****#docomo.ne.jp, ******#softbank.ne.jp. But I always get an error.
Example:
An error occurred while trying to deliver the mail to the following recipients:
******#docomo.ne.jp
Final-Recipient: rfc822; ******#docomo.ne.jp
Action: failed
Diagnostic-Code: smtp; 550 Unknown user ******#docomo.ne.jp
Status: 5.3.0
in my opinion, your mail domain is not supported in sending email through third party apps such as SES (or maybe some settings in your mail is blocking it).
i have tried to send mail from Yahoo and its not working. then i tried to send it via Gmail and send it to that Gmail account itself. it works like charm.
so my solution is: you better try another mail domain in this problem.
It turns out that a large percent of the bounced mail that SES
forwards back isn't actually 100% readable by Gmail.
If this is your case, you can find the actual cause inside the *eml download file.
See more at https://forums.aws.amazon.com/thread.jspa?threadID=324457
In my case was related to the suppression list for my AWS account
In my case, I verified the email & getting the issue as in the question.
I can able deliver the mail After I verified the domain.
I think No verification required for non-business domains like (Gmail, Outlook, etc..) & custom domain requires verification.
Had issues with sending with #yahoo.com domain myself and this post helped me confirm my suspicions. Used a #gmail.com domain (with no custom profile settings) and it worked first try.

Put raw emails into an IMAP account?

I am working on testing internationalization of an email reader application. As such I'd like to have a bank of emails with unusual subject encodings and the like to test with. I have been successful at identifying some emails with the headers endoded in specific encodings I would like to test, however I'm not sure how to successfully get the emails into an IMAP account (or alternatively a POP3 account would suffice as well) without butchering the existing headers/encodings.
With Outlook, for example, I can drag and drop messages into the IMAP account from my regular POP3 email account, or use the "resend" feature to send the message to a different account, however, with both of those solutions, outlook re-encodes the headers using it's own choice of encodings. So, for example, instead of the subject being base64 encoded, suddenly it's quoted-printable encoded, and I need it to stay base64 encoded.
So can anyone suggest how to get raw emails imported into an IMAP (or Pop3) account without changing the header encodings for fields such as subject?
Just use some IMAP client, you can store messages to IMAP server.
One free C# IMAP client you can get from:
http://www.lumisoft.ee/lsWWW/download/downloads/Examples/
SotreMessage allows you store raw message to IMAP server.
Also if you have messages in IMAP server and wnat to ttransfer them, you can use IMAP sync application from same link.
If it's just for testing, set up an IMAP server locally, and store the messages on that. Choose some fairly transparent storage so that each message is a file on the server. Don't use an email client to write them, they are just text files (and in particular not Outlook!)

Sending account verification email with perl and sendmail/postfix

For my Perl web application, I need account verification via email.
I already have a sub to generate and handle the unique link and an email composing and sending mechanism (with Email::Sender CPAN module) and it works fine - it sends emails and they get delivered.
The problem is they hit spam filters, I think it's because 'From' is 'noreply#example.org' and the user I run a script as is roman#example.org. If I send email with the same exact script with 'From: roman#example.org', it is delivered properly and does not hit the filter.
I have a root privileges on the server and can add users and configure postfix, but the question is what should I do? Run webapp as a user noreply having permissions to send mail? Changing postfix settings? Should I use MDA at all or it's better to stick with Net::SMTP or Email::Sender for a lightweight application?
I understand that an exact answer for that question might help spammers, so general direction and links to documentation I need to read would be enough.
from Example robot noreply#example.org
to myactualaccount[#]gmail.com
date Mon, Jun 13, 2011 at 9:45 PM
subject test
hide details 9:45 PM (15 hours ago)
This message is short, but at least it's cheap!
Be sure you are setting the envelope information.
Also, maybe configure Email::Sender to use the SMTP transport rather than sendmail and it should set the envelope sender to the same as the From: address without interference from postfix.

How do I build a notification email/reply system like Facebook?

When users receive a notification email about a new private message on Facebook, they can reply to the email and have their response automatically added to the conversation on the site.
How can I build a cross platform system like that? I'm building a group chat system.
This is obviously way over-simplified, but here we go:
The way Facebook's emails work is by using a string that's unique to the receiver in the reply-to address:
<m+50edqb50000003jtdj389k6xib6hofj6t41q1c45sdt92qc#reply.facebook.com>
So when Facebook receive an email into reply.facebook.com, they (presumably) parse the string after the plus sign, decide which user/conversation it's relevant to, and add the text of the email into that conversation.
One option:
Send every notification email with a unique reply-to address, then receive replies with a customized SMTP server that will pair responses with the originating message object in your DB.
Since you are using django (according to your tags) I would recommend looking at the Lamson python SMTP server. It can be programmed to correctly attribute each message. Using Lamson with Django is documented.