Jump to content

PHP SDK?


Recommended Posts

hi, i tried send mail from server side by php sdk but it's not work, i can callRemote to mailer.php! Can you help me?

php file;

<?php

include( "sdk/mta_sdk.php" );

$input = mta::getInput();

$subject = $input[0];

$email = $input[2];

$message = $input[3];

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= $input[1] . "\r\n";

$mailSent = mail($email, $subject, $message, $headers);

if ($mailSent) {

mta::doReturn("Email sent to ".$email);

echo "\r\nMail sent to $email with text: $message!";

}

else

{

mta::doReturn("Failed to send email to ".$email." - Unknown error, restart script and check webpage!", 2);

}

?>

lua file:

function toSQL(stuff)

return mysql:escape_string(stuff)

end

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)

outputDebugString("ok")

local header = "From: "..subject.." <"..(header or fromRandom())..">"

callRemote("http://gtavlife.net/MTA/emailer.php", returns, subject, header, sendto, mail) -- This website is not available any more so add the PHP files in your own website and put URL here.

outputDebugString(sendto)

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

how about acl.xml

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