Jump to content

email send problem


Burak5312

Recommended Posts

 

I want to send an email from the lua script, it says it was sent successfully, but the email is not received.

ghjukst.png

8v6rxaw.png

server:

local allowed = {{48, 57}, {65, 90}, {97, 122 }}

function generateString (len)  
    if tonumber (len) then
        math.randomseed(getTickCount())

        local str = ""
        for i = 1, len do
            local charlist = allowed[math.random( 1, 3 )]
            str = str .. string.char (math.random(charlist[1], charlist[2] ))
        end

        return str
    end

    return false
end

function sendMailTo (mail, sender, headertext, text)
   callRemote ("http://localhost/mail.php", EMailAccepted, mail, sender, headertext, text)
end

function EMailAccepted ()
   outputDebugString ("E-Mail was succesfully sended." )
end

addCommandHandler("sendmail", function()
   local resetKey = generateString(12)
   sendMailTo("[email protected]", "[email protected]", "Password Reset", "Here your password reset code: "..resetKey)
end)

php:

<?php 	
	require_once 'C:\Users\Burak2346\vendor\autoload.php';
	$input = mta::getInput();
	mail($input[0], $input[2], $input[3], "From: ".$input[1]."\n" . "Content-Type: text/html; charset=iso-8859-1\n"); 
?>

 

Link to comment

other errors are gone but now it gives error like this and the mail is still not coming

ogw9tfe.PNG

850ac6d.PNG

php:

<?php 	
	require_once 'C:\Users\Burak2346\vendor\autoload.php';
	use MultiTheftAuto\Sdk\Mta;
	$input = Mta::getInput();
	mail($input[0], $input[2], $input[3], "From: ".$input[1]."\n" . "Content-Type: text/html; charset=iso-8859-1\n"); 
?>

 

Link to comment

Problem Solved

The problem of not sending email is because gmail does not have "2-step verification" enabled.

For php warnings, it is necessary to check the array with isset.

<?php   
    include("sdk/mta_sdk.php");
    $input = mta::getInput();
    if(isset($input[0]) && isset($input[1]) && isset($input[2]) && isset($input[3]))   
    {
     $resetMail = mail($input[0], $input[2], $input[3], "From: ".$input[1]."\n" . "Content-Type: text/html; charset=iso-8859-1\n");
     if($resetMail){
      mta::doReturn("Success");
     }
     else{
      mta::doReturn("Failed");
     } 
    }
?>

 

Edited by Burak5312
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...