i’m getting this error can someone tell me how to solve. I just want to have a simple script which can send an email when a post request is made. That was working absolutely fine on local server but in production i’m getting this error. If anyone can help that will be great.
See this:
Related topic with some help by Admin
You cannot send mail in free hosting.
You can use some kind of smtp to do so.
One of the best smtp is PHP mailer().
For more information REPLY.
Thanks for contributing…
I’m already using PHPmailer…
The problem isn’t the mail but the code isn’t even executing …
i have this code
<?php
header("Content-Type:application/json");
if(isset($_POST["body"]) && isset($_POST["subject"])){
try {
$response["msg"] = "sended successfully";
echo json_encode($response);
}
//catch exception
catch(Exception $e) {
$response["msg"] = "sending failed";
echo json_encode($response);
}
}
?>
But when i send request using postman i got an error
instead of getting any response back
The thing is you are using javascript instead of using javascript you can go for PHP.
And also to ask you that have you create the files name class.phpmailer.php and smtp.phpmailer.php if you are still struggling just tell i will send you the whole working code.
PHP mail() won’t work here, but PHPmailer can work if used with SMTP.
And it will also only work if you access your website through a browser. We don’t support API hosting here, and the weird response you see is the security check we’ve implemented to enforce that:
If you open your website in a web browser, then it should work. If you were trying to use our hosting for an email API, that’s not something we can host.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.