Gmail验证php网站项目的密码

时间:2018-07-31 15:45:48

标签: php mysql database webpage

我对php的编码有疑问。我还是php / html网页的新手。我从youtube的Derrick Abucheri爵士那里获得了修订和提示:

链接为:https://www.youtube.com/watch?v=M-_bAZdYEy4

我的问题是如何获取gmail的身份验证。我尝试进行更改,但现在仍然可以找到答案,这是代码:

谢谢

<?php
header('Content-type: application/json');
$status = array(
    'type'=>'success',
    'message'=>'Email sent!'
);

$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 = 'shirokamikaze111@gmail.com';

$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

echo json_encode($status);
die; 

0 个答案:

没有答案