Include sendemail
#5

Quote:
Originally Posted by bgedition
Посмотреть сообщение
You probably will have the player's email stored(probably when they log in) in an enum in the script.
Then you would make a POST request to an endpoint to the PHP script, in that request you would also pass the player's email, the message and the subject.

Edit:
You can use this as an example: https://sampforum.blast.hk/showthread.php?tid=351065
The email is not delivered... further down the source code:

sendemail.inc
Код HTML:
#include <a_http>

#if !defined Function
	#define Function::%0(%1)    %0(%1); public %0(%1)
#endif
Function::SendMail(EmailTo[],Subject[],Message[],EmailFrom[]) {
    new Link[1200];
    //format(Link,sizeof(Link),"saveg.ro/sendemail.php?EmailTo=%s&Subject=%s&From=%s&Message=%s",EmailTo,Subject,EmailFrom,Message);
    format(Link,sizeof(Link),"saveg.ro/sendemail.php?code=44514&EmailTo=%s&Subject=%s&Message=%s&EmailFrom=%s",EmailTo,Subject,Message,EmailFrom);
    for(new c; c < strlen(Link)+1; c++) if(Link[c] == ' ') Link[c] = '+';
    HTTP(0, HTTP_POST, Link, "", "");
    return 1;
}
sendemail.php
PHP код:
<?php 
if (isset($_GET['code'])) { //checks if request from SA:MP server contains code 
    
$code $_GET['code'];//Redefine just to look better :) 
    
if($code == 44514) { // Compare code from SA:MP request, a.k.a password to avoid spam or unauthorized requests 
        
if (isset($_GET['Message']) && !empty($_GET['Message'])) { //Checks if request from SA:MP server contains messag you want to send 
            //EmailTo[],Subject[],Message[],EmailFrom[]
            
$emailto $_GET['EmailTo'];
            
$subject $_GET['Subject'];
            
$message $_GET['Message'];//Redefine just to look better :) 
            
$message str_replace("-"," ",$message);//Replace all - back to blank space as url cant contains blank spaces
            
mail($emailto$subject$message,"From: \"SA:MP server\" <support@saveg.ro>\r\n" ."X-Mailer: PHP/" phpversion());//Send an email, format: To,Subject,Message,From 
            
echo "Email delivered";//Response message to SA:MP server, so server knows request was valid 
        

    } 

?>
EDIT: In gamemode i have:
Код HTML:
format(emails, sizeof(emails), "Salutare %s,\nAi primit acest email pentru ca pe serverul rpg.og-times.ro cineva s-a logat dintr-o locatie diferita/de pe un PC diferit pe contul tau.\nDaca tu esti persoana ce s-a logat pe cont, click pe link-ul de mai jos pentru deblocarea contului: key - %s", PlayerInfo[playerid][pNormalName], key2);
SendMail(PlayerInfo[playerid][pEmail], emails, "saveG.ro - Securitate cont / Account security", "support@saveg.ro");
Reply


Messages In This Thread
Include sendemail - by qRazor - 24.03.2019, 12:55
Re: Include sendemail - by bgedition - 24.03.2019, 15:22
Re: Include sendemail - by qRazor - 24.03.2019, 15:45
Re: Include sendemail - by bgedition - 24.03.2019, 16:25
Re: Include sendemail - by qRazor - 24.03.2019, 20:16
Re: Include sendemail - by iorp - 24.03.2019, 20:35
Re: Include sendemail - by qRazor - 25.03.2019, 14:24
Re: Include sendemail - by qRazor - 25.03.2019, 20:45

Forum Jump:


Users browsing this thread: 2 Guest(s)