Email google应用程序引擎php代码
我已经在GoogleAppEngine上部署了我的应用程序。用户在表单上输入的输入将调用email.php文件(在下面的代码中提到)来发送电子邮件。 但是,当我部署它时,当调用php文件(email.php)时,脚本不会执行,脚本将显示在localhost中。 我已经阅读了关于配置app.yaml文件的其他帖子,但没有帮助。 让我知道必须做什么 app.ymlEmail google应用程序引擎php代码,email,google-app-engine,google-app-engine-php,Email,Google App Engine,Google App Engine Php,我已经在GoogleAppEngine上部署了我的应用程序。用户在表单上输入的输入将调用email.php文件(在下面的代码中提到)来发送电子邮件。 但是,当我部署它时,当调用php文件(email.php)时,脚本不会执行,脚本将显示在localhost中。 我已经阅读了关于配置app.yaml文件的其他帖子,但没有帮助。 让我知道必须做什么 app.yml application: shop_app version: alpha-001 runtime: php55 api_ve
application: shop_app
version: alpha-001
runtime: php55
api_version: 1
handlers:
-url: /email.php
script: assets/email.php
.php文件
<?php
$name = $_POST['fname'];
$lname = $_POST['lname'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
// Create the email and send the message
$to = 'vikraj@gmail.com';
$email_subject = "Website Contact Form: $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nFirst Name: $name\n\nLast Name:$lname\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n\n$message";
$headers = "From: userjoe@gmail.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
/* Redirect browser */
header("Location: index.html");
?>
YAML文件中的缩进很重要。当我测试这个脚本时,它运行得很好(部署的和本地的-mail()都是存根),所以这是唯一看起来不正确的地方。当我测试这个脚本时,它运行得很好(部署的和本地的-mail()都是存根),所以这是唯一看起来不正确的地方。