Jump to content

SEND EMAIL MTA - Anybody know


#[B]lack

Recommended Posts

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