Guest User

Mailer include

a guest
Apr 9th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.60 KB | None | 0 0
  1. /*
  2. This Include is made by Frede(Frederik Svend Vester). By using this you agree with following
  3.     *Keep my credits
  4.     *Of cause you most edit this and the PHP code if you just Keep my Credits
  5.     *If you want to rerelease it then you most keep my credits. And ask me first
  6. This was the agreements, however if you create a new design in this please do it public. This is not requiet, however, most people like to have some design, so why not make others happy.
  7.                     ///////////////////////////////////////////////////////
  8.                     //    ********  ******    *******   *****     ****** //
  9.                     //    *         *     *   *         *    *    *      //
  10.                     //    *         *     *   *         *     *   *      //
  11.                     //    *****     ******    ****      *     *   ****   //
  12.                     //    *         *     *   *         *     *   *      //
  13.                     //    *         *     *   *         *    *    *      //
  14.                     //    *         *     *   *******   *****     ****** //
  15.                     ///////////////////////////////////////////////////////
  16.  
  17. --------------------------------------------------------------------------------
  18.                         [CREDITS]
  19.                     Me(Frede) - Creating the include
  20.             Slice - Giving me the idea. And i have used some of the functions from slice's include
  21. */
  22.  
  23. #if(!defined ServerLink)
  24.     #error Please define the serverlink - IP:PORT
  25.  
  26. #endif
  27.  
  28. #if(!defined forumlink)
  29.     #error Please define the forumlink - without HTTP://
  30.  
  31. #endif
  32.  
  33. #if(!defined ServerLogoLink)
  34.     #error Please define the serverLogolink
  35.  
  36. #endif
  37.  
  38. #if(!defined ServerName)
  39.     #error Please define the ServerName
  40.  
  41. #endif
  42.  
  43. #if(!defined PHPLink)
  44.     #error Please define the PHPLink (If you did then you possible did it before you included the include. So please define it before you include)
  45.  
  46. #endif
  47.  
  48. #if(!defined MAX_MAIL_Length)
  49.     #define MAX_MAIL_Length 1024
  50.  
  51. #endif
  52.  
  53. #if(!defined MAX_MAIL_TYPES)
  54.     #define MAX_MAIL_TYPES 2
  55.  
  56. #endif
  57. //forward mailback(playerid);
  58.  
  59. forward OnNiceMailResponse(playerid, response_code, data[]);
  60. public OnNiceMailResponse(playerid, response_code, data[])
  61. {
  62.     print(data);
  63.     if(response_code != 200)
  64.     {  
  65.         print("***A ERROR OCCURED WHEN SOMEBODY TRIED TO RUN NICEMAIL***");
  66.         printf("ERROR: response was=%d - BAD PHPLINK", response_code);
  67.         SendClientMessage(playerid, 0xFFFFFF, "***A ERROR OCCURED WHEN SOMEBODY TRIED TO RUN NICEMAIL***");
  68.         SendClientMessage(playerid, 0xFFFFFF, "***Check server_log.txt to see the error***");
  69.         return -1;
  70.     }
  71.     else return 1;
  72. }
  73. #define GREAT_MAIL 0
  74. #define SIMPLE_MAIL 1
  75. #define EASY_MAIL 2
  76.  
  77. #include <a_samp>
  78. #include <a_http>
  79.  
  80. stock nicemail(type, reciveremail[], recivername[], senderemail[], sendername[], subject[], message[], playerid = -1)
  81. {
  82.     if(type > MAX_MAIL_TYPES || type < 0)
  83.     {
  84.         print("***A ERROR OCCURED WHEN SOMEBODY TRIED TO RUN NICEMAIL***");
  85.         printf("ERROR: type=%d - Your type most be between 0-2", type);
  86.         SendClientMessage(playerid, 0xFFFFFF, "***A ERROR OCCURED WHEN SOMEBODY TRIED TO RUN NICEMAIL***");
  87.         SendClientMessage(playerid, 0xFFFFFF, "***Check server_log.txt to see the error***");
  88.         return -1;
  89.     }
  90.     //mailback(playerid);
  91.     new mail[MAX_MAIL_Length+250];
  92.     format(mail, sizeof(mail), "t=%i&r=%s&rn=%s&se=%s&sn=%s&sb=%s&m=%s&lo=%s&sen=%s&link=%s&fl=%s",type, reciveremail, recivername, senderemail, sendername, subject, message, ServerLogoLink, ServerName, ServerLink, forumlink);
  93.     HTTP(playerid, HTTP_POST, PHPLink, mail, "OnNiceMailResponse");
  94.     print(mail);
  95.     printf("[Mail Send]------------------\nTo=%s - %s\nFrom=%s -%s\nSubject= %s\ntype=%d\n----------------------------", reciveremail, recivername, senderemail, sendername, subject, type);
  96.     return 1;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment