WhoAmI Posted April 4, 2015 Share Posted April 4, 2015 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
ALw7sH Posted April 4, 2015 Share Posted April 4, 2015 mta_sdk.php, is it in the same folder with your php file ? Link to comment
ALw7sH Posted April 4, 2015 Share Posted April 4, 2015 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
WhoAmI Posted April 4, 2015 Author Share Posted April 4, 2015 No, I wanted to do return in this function. If email was sent succesfuly it outputs true, if not false. Link to comment
WhoAmI Posted April 4, 2015 Author Share Posted April 4, 2015 Anyway, it outputs error event if I'm using your code. Maybe problem is that I'm using callRemote in localhost server? Link to comment
ALw7sH Posted April 4, 2015 Share Posted April 4, 2015 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
WhoAmI Posted April 4, 2015 Author Share Posted April 4, 2015 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
WhoAmI Posted April 4, 2015 Author Share Posted April 4, 2015 Fixed. It was problem with my VPS. 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