summaryrefslogtreecommitdiff
path: root/src/char_sql/int_mail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char_sql/int_mail.c')
-rw-r--r--src/char_sql/int_mail.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/char_sql/int_mail.c b/src/char_sql/int_mail.c
index 9ef9f9fd3..9ae4e1ccd 100644
--- a/src/char_sql/int_mail.c
+++ b/src/char_sql/int_mail.c
@@ -429,6 +429,27 @@ static void mapif_parse_Mail_send(int fd)
mapif_Mail_send(fd, &msg);
}
+void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item)
+{
+ struct mail_message msg;
+ memset(&msg, 0, sizeof(struct mail_message));
+
+ msg.send_id = send_id;
+ safestrncpy(msg.send_name, send_name, NAME_LENGTH);
+ msg.dest_id = dest_id;
+ safestrncpy(msg.dest_name, dest_name, NAME_LENGTH);
+ safestrncpy(msg.title, title, MAIL_TITLE_LENGTH);
+ safestrncpy(msg.body, body, MAIL_BODY_LENGTH);
+ msg.zeny = zeny;
+ if( item != NULL )
+ memcpy(&msg.item, item, sizeof(struct item));
+
+ msg.timestamp = (int)calc_times();
+
+ mail_savemessage(&msg);
+ mapif_Mail_new(&msg);
+}
+
/*==========================================
* Packets From Map Server
*------------------------------------------*/