Jump to content

Email System from Community - Not working


Recommended Posts

Error: E-Mail not sent due to webpage errors, check the script and/or page provided. 

Resource: https://community.multitheftauto.com/index.php?p= ... s&id=11231

  
local randomMails = {"[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"} 
function fromRandom() 
    return randomMails[math.random(#randomMails)] 
end 
  
function sendCustomMail(subject, header, sendto, mail) 
    local header = "From: "..subject.." <"..(header or fromRandom())..">" 
    callRemote("http://mta.skcit.tk/emailer.php", returns, subject, header, sendto, mail) 
end 
addEvent("sendEMail", true) 
addEventHandler("sendEMail", root, sendCustomMail) 
  
function returns(msg, num) 
    if msg == "ERROR" or (not msg) then 
        outputDebugString("E-Mail not sent due to webpage errors, check the script and/or page provided.", 2) 
    else 
        outputDebugString(msg, num or 3) 
    end 
end 

Server Side -

I tried that website, but it don't exist anymore, and I really need this resource? Anyway I can fix it?

http://mta.skcit.tk/emailer.php

Link to comment
Okay I setup mailer.php and mta_sdk.php it says mail sent but I check my email nothing is there.

try this untested

-- Sever side

function returnMail(result, player) 
    if result == true then 
        outputChatBox("You mail has been successfully sended !", player, 255, 255, 255, true) 
    else 
        outputChatBox("Sorry, there is a problem in your website", player, 255, 255, 255, true) 
    end 
end 
  
addEvent("sendEMail", true) 
addEventHandler("sendEMail", getRootElement(), 
function(player, target, subject, msg) 
    callRemote ( --[[ you website here ]], returnMail, player, target, subject, msg ) 
end) 

-- Php

<?php 
include( "mta_sdk.php" ); 
$input = mta::getInput(); 
$player = $input[0]; 
$target = $input[1]; 
$subject = $input[2]; 
$message = $input[3]; 
$mail = $target;  
  
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail)) 
{ 
    $passage_ligne = "\r\n"; 
} 
else 
{ 
    $passage_ligne = "\n"; 
} 
  
$message_txt = " "; 
$message_html = "Test".$message.""; 
$boundary = "-----=".md5(rand()); 
$sujet = "MTA - ".$subject.""; 
$header = "From: \"MTA\"<[email protected]>".$passage_ligne; 
$header.= "Reply-to: \"MTA\" <[email protected]>".$passage_ligne; 
$header.= "MIME-Version: 1.0".$passage_ligne; 
$header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne; 
$message = $passage_ligne."--".$boundary.$passage_ligne; 
$message.= $passage_ligne."--".$boundary.$passage_ligne; 
$message.= "Content-Type: text/html; charset=\"ISO-8859-1\"".$passage_ligne; 
$message.= "Content-Transfer-Encoding: 8bit".$passage_ligne; 
$message.= $passage_ligne.$message_html.$passage_ligne; 
$message.= $passage_ligne."--".$boundary."--".$passage_ligne; 
$message.= $passage_ligne."--".$boundary."--".$passage_ligne; 
mail($mail,$sujet,$message,$header); 
$theresult = true; 
mta::doReturn($theresult, $player); 
?> 

Link to comment

If you are using apache on VPS you have to configure mail server on it. I had the same problem.

If you have mail configured, check spam. I've used the same resource and you don't have to change anything in it. If it doesn't work, it's caused by WWW server.

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...