Thread Tools Display Modes
03/09/15, 09:42 AM   #1
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
Mail API

Is there a way to "track" a mailed could if it's accepted or declined? Example if I cod someone something and they accept or decline, is there a way to track it? I'm wanting to do some functionality when someone accepts my cod, I save the information about the mail. I know mailr tracks sent mails but I'm looking to basically match up a send and receive response.

Would I use "getnextmailid" then store that number and check to see if the mail received back matches the number returned from "getnextmailid"?
  Reply With Quote
03/09/15, 02:38 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,971
Ok, as your threads are duplicate I'll answer you here and remove the other post in your old thread:

I only know of the following EVENTS that trigger upon incoming emails or interaction with the MAIL_INBOX:

Lua Code:
  1. EVENT_MAIL_INBOX_UPDATE
  2. EVENT_MAIL_READABLE
  3. EVENT_MAIL_TAKE_ATTACHED_ITEM_SUCCESS
  4. EVENT_MAIL_TAKE_ATTACHED_MONEY_SUCCESS
  5. EVENT_MAIL_REMOVED
  6. EVENT_MAIL_NUM_UNREAD_CHANGED

You could use EVENT_MAIL_READBALE e.g. and register a new callback function and check the incoming COD amount by help of the mail id.

Or you Pre-hook this function here to above to get the COD amount:
Lua Code:
  1. function ZO_MailInboxShared_PopulateMailData(dataTable, mailId)
  2.     local senderDisplayName, senderCharacterName, subject, icon, unread, fromSystem, fromCS, returned, numAttachments, attachedMoney, codAmount, expiresInDays, secsSinceReceived = GetMailItemInfo(mailId)
  3.     dataTable.mailId = mailId
  4.     dataTable.subject = subject
  5.     dataTable.returned = returned
  6.     dataTable.senderDisplayName = senderDisplayName
  7.     dataTable.senderCharacterName = senderCharacterName
  8.     dataTable.expiresInDays = expiresInDays
  9.     dataTable.unread = unread
  10.     dataTable.numAttachments = numAttachments
  11.     dataTable.attachedMoney = attachedMoney
  12.     dataTable.codAmount = codAmount
  13.     dataTable.secsSinceReceived = secsSinceReceived
  14.     dataTable.fromSystem = fromSystem
  15.     dataTable.fromCS = fromCS
  16.     dataTable.priority = fromCS and 1 or 2
  17.     dataTable.GetFormattedSubject = GetFormattedSubject
  18.     dataTable.GetExpiresText = GetExpiresText
  19.     dataTable.GetReceivedText = GetReceivedText
  20. end

If it is 0 the other one did not accept it, I guesss.

I'm not sure if the MailID is the same as the send one but would make sense I guess.
  Reply With Quote
03/09/15, 02:56 PM   #3
Argusus
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 120
Thanks for your response, I will have to test out and see if the getnextmailid is indeed the correct mail id for the response when EVENT_MAIL_READABLE and it passes the mail id that was selected , if so this would work. Just really wanting to be able to establish/find a relationship between a send and reply. With out comparing title or something else.



Originally Posted by Baertram View Post
Ok, as your threads are duplicate I'll answer you here and remove the other post in your old thread:

I only know of the following EVENTS that trigger upon incoming emails or interaction with the MAIL_INBOX:

Lua Code:
  1. EVENT_MAIL_INBOX_UPDATE
  2. EVENT_MAIL_READABLE
  3. EVENT_MAIL_TAKE_ATTACHED_ITEM_SUCCESS
  4. EVENT_MAIL_TAKE_ATTACHED_MONEY_SUCCESS
  5. EVENT_MAIL_REMOVED
  6. EVENT_MAIL_NUM_UNREAD_CHANGED

You could use EVENT_MAIL_READBALE e.g. and register a new callback function and check the incoming COD amount by help of the mail id.

Or you Pre-hook this function here to above to get the COD amount:
Lua Code:
  1. function ZO_MailInboxShared_PopulateMailData(dataTable, mailId)
  2.     local senderDisplayName, senderCharacterName, subject, icon, unread, fromSystem, fromCS, returned, numAttachments, attachedMoney, codAmount, expiresInDays, secsSinceReceived = GetMailItemInfo(mailId)
  3.     dataTable.mailId = mailId
  4.     dataTable.subject = subject
  5.     dataTable.returned = returned
  6.     dataTable.senderDisplayName = senderDisplayName
  7.     dataTable.senderCharacterName = senderCharacterName
  8.     dataTable.expiresInDays = expiresInDays
  9.     dataTable.unread = unread
  10.     dataTable.numAttachments = numAttachments
  11.     dataTable.attachedMoney = attachedMoney
  12.     dataTable.codAmount = codAmount
  13.     dataTable.secsSinceReceived = secsSinceReceived
  14.     dataTable.fromSystem = fromSystem
  15.     dataTable.fromCS = fromCS
  16.     dataTable.priority = fromCS and 1 or 2
  17.     dataTable.GetFormattedSubject = GetFormattedSubject
  18.     dataTable.GetExpiresText = GetExpiresText
  19.     dataTable.GetReceivedText = GetReceivedText
  20. end

If it is 0 the other one did not accept it, I guesss.

I'm not sure if the MailID is the same as the send one but would make sense I guess.
  Reply With Quote
03/11/15, 01:20 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,971
If you find out please share your research info with us. Thanks
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Mail API


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off