php - Sendemail using json -
this question has answer here:
i using template having trouble sending email using sendemail.php. not figure out problem. here codes
<?php header('content-type: application/json'); $status = array( 'type'=>'success', 'message'=>'mesajınız gönderildi!' ); $name = @trim(stripslashes($_post['name'])); $email = @trim(stripslashes($_post['email'])); //$subject = @trim(stripslashes($_post['subject'])); $message = @trim(stripslashes($_post['message'])); $email_from = $email; $email_to = 'emailxxx@gmail.com'; $body = 'name: ' . $name . "\n\n" . 'email: ' . $email . "\n\n" . 'message: ' . $message; $success = @mail($email_to, $body, 'from: <'.$email_from.'>'); echo json_encode($status); die;
here html part of codes
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php" role="form"> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <input type="text" class="form-control" required="required" placeholder="İsim"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <input type="text" class="form-control" required="required" placeholder="email"> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="mesajınız"></textarea> </div> <div class="form-group"> <button type="submit" class="btn btn-danger btn-lg">gönder</button> </div> </div> </div> </form>
please me :-)
try using mail library such phpmailer. sendmail notoriously unreliable.
Comments
Post a Comment