Jump to content

callRemote


WhoAmI

Recommended Posts

Hello.

I'm using something like this:

function sendEmail ( bool, subject, sendto, message ) 
    outputChatBox ( tostring ( bool ) ); 
    if ( bool == "true" ) then 
        outputChatBox ( "test1" ); 
        return true; 
    elseif ( bool == "false" ) then 
        return false; 
    end 
     
    if ( not bool ) then 
        local header = "From: " .. subject .. " <" .. globalEmail .. ">"; 
        local call = callRemote ( ***, sendEmail, subject, header, sendto, message ); 
        outputChatBox ( tostring ( call ) ); 
    end 
end 

And it returns me ERROR all the time. I'm 100% sure that PHP file is correct. Because I even changed it to:

<?php 
    include ( "mta_sdk.php" ); 
    $i = mta::getInput ( ); 
    mta::doReturn ( "test" ); 
?> 

And it still outputs "ERROR", no matter what. Also when I go to url which i gave to callRemote function it shows me ["test"], so website works fine. callRemote function returns true.

What can be a problem?

Link to comment

idont know if this effect but it's not should be like that?

function result(bool) 
outputChatBox ( tostring ( bool ) ); 
    if ( bool == "true" ) then 
        outputChatBox ( "test1" ); 
        return true; 
    elseif ( bool == "false" ) then 
        return false; 
    end 
end 
  
function sendEmail ( subject, sendto, message ) 
    local header = "From: " .. subject .. " <" .. globalEmail .. ">"; 
    local call = callRemote ( ***, result, subject, header, sendto, message ); 
    outputChatBox ( tostring ( call ) ); 
end 

Link to comment

this is the same code but with fetchRemote.

function result(bool,errono) 
    if errono  == 0 then 
    outputChatBox(bool) 
    else 
    outputChatBox("ERROR:"..errono) 
    end 
end 
  
function sendEmail( subject, sendto, message ) 
    local header = "From: " .. subject .. " <" .. globalEmail .. ">" 
    local call = fetchRemote ( "www.exmaple.com/myPHP.php?subject="..subject.."&header="..header.."&sendto="..sendto.."&message="..message, result, "", false) 
end 

<?php    $subject = $_GET["subject"];    $header = $_GET["header"];    $sendto = $_GET["sendto"];    $message = $_GET["message"];    if ($subject && $header && $sendto && $message) {    echo "true";    } else {    echo "false";    }?>

Link to comment

Well, I fixed it and I use callRemote. I made mistake in spelling the word, my bad. Now I have this code

<?php 
    include ( "mta_sdk.php" ); 
    $i = mta::getInput ( ); 
    $subject  = $i[0]; 
    $email    = $i[2]; 
    $message  = $i[3]; 
    $headers  = 'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    $headers .= $i[1] . "\r\n"; 
    $mailSent = mail ( $email, $subject, $message, $headers ); 
    if ($mailSent) { 
        mta::doReturn ( "true" ); 
    } else { 
        mta::doReturn ( "false" ); 
    } 

It's not ERROR this time. It returns "false". I checked what $email, $subject, $message, $headers return and they return correct values. Any advice from pros?

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