This is my function in map/script.c
Work best with SMTP authentication & mail client on linux box.
Useage: sendmail "messages..."; or sendmail("messages...");
---------------- +Code ----------------
#include<string.h>
#include<stdio.h>
.
.
BUILDIN_FUNC(sendmail)
{
struct npc_data* nd = NULL;
const char* str = script_getstr(st,2);
if (script_hasdata(st, 3))
nd = npc_name2id(script_getstr(st, 3));
else
nd = (struct npc_data *)map_id2bl(st->oid);
if (nd != NULL && nd->chat_id) {
char message[80];
safesnprintf(message, sizeof(message), "%s", str);
char newstr[256];
strcpy(newstr, "echo \"");
strcat(newstr, message);
strcat(newstr, "\" | mail -s \"Fixed Subject\"
[email protected]");
system(newstr);
}
return SCRIPT_CMD_SUCCESS;
}
.
.
BUILDIN_DEF(sendmail,"s?"),