Google apps script.
How can i get ip of the email sender or from contacts in gmail contacts. I can import contact details from a group or mail threads from inbox. can i get the ip address of sender by apps script code sample?
Thanks in advance.
Google apps script.
How can i get ip of the email sender or from contacts in gmail contacts. I can import contact details from a group or mail threads from inbox. can i get the ip address of sender by apps script code sample?
Thanks in advance.
You simply cannot do that... moreover, the IP adress of a contact is something that doesn't exist in real world, the IP a user is using depends on where the contact is doesn't it ?
This gets the originating IP from the first email thread in you inbox:
var thread = GmailApp.getInboxThreads(0,1)[0]; // get first thread in inbox
var message = thread.getMessages()[0]; // get first message
var rawMessage = message.getRawContent();
var lines = rawMessage.split('\n');
for each(line in lines){
if(line.substring(0,'X-Originating-IP'.length)=='X-Originating-IP'){
Logger.log(line);
}
}