quote:
Originally posted by cloudhunter
It does exactly what you want. When it receives an origin, it looks for the people in the chat window, and finds out the email address. Saves iterating through all the Contacts.
which will only work when there is only 1 contact in the chat though, and which you need to explicitly check on or you might end up with the wrong contact.
Also you need to check if the message doesn't come from yourself. eg: if you explicitly use what Matty posted you can end up with the contact's email, while the message was actually being send by you..
------
Robin4286
quote:
Originally posted by Robin4286
Well thats not really accomplishing what I am trying to do. What I want to do is return who sent the email, not who is in the conversation.
it is exactly what you need as you need to know who is in the conversation to check the Origin (the name) against.
So with what Matty showed, you can easly iterate thru all the contacts and getting their name and comparing it to the origin.
If there is only one contact, the iteration will be extremely short (1), if there are more than one contact, the iteration would still be short (compared to checking your whole contactlist)...
So what you need to make this:
- the code from Matty and how to iterate thru the contacts in the chat window (which is exactly what he showed).
- comparing their Name with the Origin parameter
- if a match occurs, get the email from that contact