I have seen a couple of incomplete answers on here. I am trying to loop over the emails in an inbox of a shared mail group and see properties like 'Sender'.
I understand that certain classes used would simply loop through my own default email inbox and not that of the group inbox specified.
Would appreciate some guidance or working example.
Related
Is there a way wherein I can track if someone replies to my email using appscript? Because I have this google sheet that serves as my tracker if my email is sent & if someone replies to my email.
Would be good to have some code as a place to start:
In summary:
Each message has an Id and for each message exist a threadId that groups all the messages from the same thread. So first you have to know this threadId.
If you want to track a reply over a message you have two options:
Look for every incoming message to see if they have the same threadId
Look for a certain threadId and see if contains more messages than the last time you'd check it
Apps script: thread.getMessages()
In any case the way to go is to setup an automated script that runs every certain time checking any of the two options.
See this related question about how to setup time triggers on incoming mails,
My objective is to track the last conversation that I have with my clients and take appropriate steps before being too late and go out of touch.
So I am looking for a way to collect the time information about the last email sent to a particular contact from my inbox and save it in google sheets. So would love to know if there is a simple code that I can input to get it running.
I am not a coder, so any assistance would be helpful. :)
You can try with the Gmail API and with the SpreadsheetApp class. The procedure could be:
List the emails to get the IDs. You can perform advanced search queries with the q parameter.
Get the internalDate using the email Id.
Update the Sheet with the SpreadsheetApp.
In the links you will see plenty examples of how to use the methods.
In my code I send an email to a specific email, but I want to store the reply that may come into a cell in the spreadsheet.
My current idea is to setup a trigger that would run every 2 hours that could check for a reply, but I have no current way to pull out a reply from the message box.
Is there a way that I can do it, or would I have to make a random "code" at the beggining of my subject on my email, so that I could parse my inbox until I have a reply? (I'm not even sure if that's possible"
You can read your inbox using 'GmailApp'. Please see the documentation below -
https://developers.google.com/apps-script/reference/gmail/gmail-app
You may look for Subject Line to fetch the email response. Store the fetched data in a variable which can then be passed to spreadsheet using setValue().
I'm making a google script that sends certain emails to a spreadsheet. I'm want the script to run every few minutes, but I want it to skip emails it already added to the document.
Is there a way in gmail to compare emails? to know which came before?
Thank you,
Chaim
There are a couple of approaches you can take.
Store the message id of the email that you have already processed. You can either store it in ScriptDb or in another spreadsheet.
You can add the message to a particular label, say "Processed". And change your script to only work on the messages that do not have the "Processed" label.
Please forgive me if this has been answered already but I've been looking around for an answer to this but haven't been able to come up with anything usefull.
We migrated a number of pilot users to google apps for their mail (coming from exchange 2003). One of those users has a number of e-mails that only exist in his sent items folder in outlook/exchange. He usually 'archives' his sent items to a subfolder of Inbox. Anything that stays in his "sent items" folder in outlook are things he still needs to follow up on. After the migration we came to the conclusion that all of the mail 'archived' in this way showed up in his "sent mail" folder/label on his outlook google profile (it is also still in the 'archive' folder).
The result is that he now has a "sent mail" folder with a couple 1000 e-mails, about +90% of those are doubles that exists in one of his 'archive' folders as well. As there are probably a number of other users (that have not been migrated yet) that have the same way of 'archiving' I was looking at a way to automate the adding of a label to messages that are only in his sent items folder/label and nowhere else. I made a simple google script that looks for the label "sent" but this is where I ran into the issue that's been blocking me from getting this done. No mather what I try, the only mails that the script finds are mails in his Inbox (sub)folder, so the script doesn't find any mail that exists only under the "sent items" label. So my question: is there any way to get a google script to loop through this label/folder?
Quick update:
I worked around this problem by doing some manual labour. I would still very much be interested in an answer to this should somebody have one.