小编ban*_*dor的帖子

Sendemail使用json

我使用模板但是使用sendemail.php发送电子邮件时遇到问题.我无法弄清楚这个问题.这是代码

<?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; 
Run Code Online (Sandbox Code Playgroud)

这是代码的html部分

 <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 …
Run Code Online (Sandbox Code Playgroud)

php email json

5
推荐指数
1
解决办法
439
查看次数

标签 统计

email ×1

json ×1

php ×1