Thread Tools Display Modes
05/13/14, 06:23 AM   #1
CatoTheElder
Join Date: May 2014
Posts: 44
SendMail function request for details

Hey All,

I'm working on a small addon for GM/Officer ease of life. The part I'm specifically having trouble with is to allow GMs and Officers to mail Officers and Recruits.

To minimize abuse, I have it coded so you can only mail people in a guild you are an officer or GM of, and you can only mail members who are officer ranked or recruit rank in that guild.

Unfortunately, I cannot get the SendMail function to work. It doesn't show any errors, or stop execution at all. It seems to run fine, it simply doesn't send any mail. For troubleshooting sake of ease:

Function:
SendMail(string to, string subject, string body)

I've tried the following (outside of an addon):
/script SendMail("@MyOfficer", "Test1", "Test1");
/script SendMail("MyOfficersToonName", "Test2", "Test2");
/script to = "@MyOfficer"; SendMail(to, "Test3", "Test3");

Can anyone verify my results, or shed some light on why I'm seeing this behaviour?

Cheers!
Cato
  Reply With Quote
05/13/14, 06:38 AM   #2
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
Hey, add some handler to this event EVENT_MAIL_SEND_SUCCESS and see if it triggers. Maybe there are some lags in postal system or something.
  Reply With Quote
05/13/14, 02:21 PM   #3
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Also, there is this event that, if it triggers may explain the reason.

EVENT_MAIL_SEND_FAILED (integer reason)

reason I suspect would be one of the following values:
EVENT_REASON_HARDWARE
EVENT_REASON_SOFTWARE

Or actually maybe one of these:
MAIL_SEND_RESULT_CANT_SEND_CASH_COD
MAIL_SEND_RESULT_CANT_SEND_TO_SELF
MAIL_SEND_RESULT_FAIL_BLANK_MAIL
MAIL_SEND_RESULT_FAIL_DB_ERROR
MAIL_SEND_RESULT_FAIL_IGNORED
MAIL_SEND_RESULT_FAIL_INVALID_NAME
MAIL_SEND_RESULT_FAIL_IN_PROGRESS
MAIL_SEND_RESULT_FAIL_MAILBOX_FULL
MAIL_SEND_RESULT_INVALID_ITEM
MAIL_SEND_RESULT_MAILBOX_NOT_OPEN
MAIL_SEND_RESULT_MAIL_DISABLED
MAIL_SEND_RESULT_NOT_ENOUGH_ITEMS_FOR_COD
MAIL_SEND_RESULT_NOT_ENOUGH_MONEY
MAIL_SEND_RESULT_RECIPIENT_NOT_FOUND
MAIL_SEND_RESULT_SUCCESS
MAIL_SEND_RESULT_TOO_MANY_ATTACHMENTS

Good Luck, if you are on the US server, feel free to throw test messages my way @Xrystal.
  Reply With Quote
05/13/14, 08:53 PM   #4
CatoTheElder
Join Date: May 2014
Posts: 44
Thanks for the suggestions. I believe I've figured this out for the most part.

When the mail panel is open, the SendMail function works fine, as well as the events for success and fail. With the mail panel closed ... nothing happens. No mail is sent, neither event fires, no errors etc.
  Reply With Quote
05/14/14, 12:56 AM   #5
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Originally Posted by CatoTheElder View Post
Thanks for the suggestions. I believe I've figured this out for the most part.

When the mail panel is open, the SendMail function works fine, as well as the events for success and fail. With the mail panel closed ... nothing happens. No mail is sent, neither event fires, no errors etc.
Makes sense. There may be some validation to make sure things are up and running. I remember wow being like this for some functions.
  Reply With Quote
05/14/14, 07:58 AM   #6
CatoTheElder
Join Date: May 2014
Posts: 44
Originally Posted by Xrystal View Post
Makes sense. There may be some validation to make sure things are up and running. I remember wow being like this for some functions.
Right, it just seems bizarre to me to not return anything, and not run the action that was called. I expected a MAIL_SEND_RESULT_MAILBOX_NOT_OPEN return, or even a 0.

That said, the function is one that can be easily abused, so I'm glad it is available at all. Manually sending a dozen mails or so at a time, is not exactly fun.

Cheers!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » SendMail function request for details


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