#[B]lack Posted December 5, 2018 Share Posted December 5, 2018 I am having difficulty sending email by mta someone has a functional code Link to comment
Investor Posted December 6, 2018 Share Posted December 6, 2018 (edited) function sendMail(to, from, title, body) local function callbackfnc(result, msg) outputDebugString("callbackfnc: " .. result .. " (" .. msg .. ")") end callRemote("https://domain.tld/path/to/file.php", callbackfnc, to, from, title, body) end <?php include("mta_sdk.php"); if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) { mta::doReturn(-1, "Remote access not allowed"); exit; } $input = mta::getInput(); if ( isset($input[0]) && isset($input[1]) && isset($input[2]) && isset($input[3]) ) { $to = $input[0]; $from = $input[1]; $subject = $input[2]; $message = $input[3]; $headers = "From: " . $input[1]; mail($to, $subject, $message, $headers); mta::doReturn(0, "Success"); } else { mta::doReturn(-1, "Invalid input"); } ?> And you need the PHP SDK (mta_sdk.php file) downloadable here: http://code.opencoding.net/mta/mtaphpsdk_0.4.zip This does not filter against malicious inputs, so make sure you never callRemote to the PHP file with unsanitised user input, or even better, don't use user input at all if possible (except the to email address I suppose) Edited December 6, 2018 by Investor Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now