Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Send mail trinity

Newbie Spellweaver
Joined
Aug 6, 2010
Messages
69
Reaction score
10
Well im using this directly to phpmyadmin, im receiving the email but no items included. Any ideias

INSERT INTO mail (messageType, stationery, sender, receiver, subject, body, has_items, expire_time, deliver_time) VALUES('0', '61', '0', '2','ADMIN GIFT','Sorry does not work yet!.','1','0','0');

INSERT INTO mail_items (item_guid, receiver) VALUES('139', '2');


139 - its a brawler's pant, just for testing...
 
Lord of the Legion
Joined
Jul 28, 2005
Messages
426
Reaction score
35
Try this:

Code:
SET @IDNUM = (SELECT MAX(ID) FROM mail)+1;
INSERT INTO mail VALUES (@IDNUM, 5, 61, 41, <GUID of admin char>, <GUID of reciever>, 'Admin Gift', '<Message>', 1, 0, 0, 0, 0, 0);
INSERT INTO mail_items VALUES (@IDNUM, <Item GUID>, <GUID of reciever>);

As far as I can tell, you did not set an ID in the mail or mail_items and mail is not auto-increment, so it must be set manually. You also set the messageType to 0, but must be 5 to mail and item. I'd imagine the reason you did not receive the items is mainly due to you not setting the message ID in mail_items.

Unfortunately, at the moment I don't have a server to test this on, however, it should work and I tested the code and it returned no errors.

Also, here's a tip to make SQL a little easier. When filling out all fields, you don't need to specify the columns and you don't need apostrophes around integers, only around text fields.

Here's some descriptions for the fields in the mail table, in order with the most commonly used bitmasks and settings:

mail:
id = Unique GUID (Not auto-increment).
messageType = Type of message being sent (Default 0, item 5).
stationery = Layout for the message (Default 41, GM 61).
mailTemplateID = Template ID for default messages (From MailTemplate.dbc (Default 0)).
sender = Character GUID being sent from (From characters table).
receiver = Character GUID to receive mail (From characters table).
subject = No explanation needed.
body = No explanation needed (If not-null, checked must be 16).
has_items = 0/1 boolean if it has item (If 1, messageType must be 5).
expire_time = Timestamp for when to return message to sender (0 for none).
deliver_time = Timestamp for timed delivery (0 for instant).
money = Amount of money (In copper) to deliver or for COD (0 for none).
cod = 0/1 boolean if using COD (Cash on delivery) (If 1, money must be over 0).
checked = Bitmask for mail status and misc (0 for default, 16 for if it has a body).

mail_items:
mail_id = GUID of mail (From mail table) to attach item to.
item_guid = GUID of item to attach (From world.item_template).
receiver = GUID of character to send to (Must be same as receiver ID in mail table).
 
Last edited:
Back
Top