HTML 在提交时使用 php 发送电子邮件的表单(Google 云服务器)
HTML form to send email using php on submit (Google Cloud Server)
我是 运行 一个 php 脚本,应该在提交表单时发送电子邮件。当我提交表单时,我收到以下错误。
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>Missing file part</Details></Error>
这是我的html代码
<html lang="en">
<head>
<script src="email_me.php"></script>
<meta charset="utf-8">
</head>
<section class="contact_us1">
<form action="email_me.php" method="post" role="form" aria-label="contact form" enctype="multipart/form-data">
<div>
<input id="field1" aria-invalid="false" name="Name" value="" placeholder="Name" data-aid="nameField" type="text" required>
<input id="field2" aria-invalid="false" name="Email" value="" placeholder="Email" data-aid="emailField" type="text" required>
<input id="field4" aria-invalid="false" name="Subject" value="" placeholder="Subject" data-aid="subjectField" type="text">
</div>
<textarea name="Message" class="message" placeholder="Message" data-aid="messageField" ></textarea>
<button type="submit" >Send</button>
</form>
</section>
这是我的 PHP 脚本
<?php
if($_POST["submit"]) {
$recipient="my@email.com"; //Enter your mail address
$subject=$_POST["Subject"]; //Subject
$sender=$_POST["Name"];
$senderEmail=$_POST["Email"];
$message=$_POST["Message"];
$mailBody="Name: $sender\nEmail Address: $senderEmail\nSubject:$subject\n\nMessage: $message";
mail($recipient, $subject, $mailBody);
sleep(1);
header("Location:http://www.affordtotrip.com/"); // Set here redirect page or destination page
}
?>
我正在使用 google 云作为服务器,为此我创建了一个存储桶。
提交后,我希望发送电子邮件并刷新页面。
更新
我经历了 php tutorial and tried to set up a custom domain
我不知道如何 link 这个 php 项目到我实际的 html 页面。我唯一遇到问题的 DNS 记录是
Custom domain name SSL Security RecordType Data Alias
Google-managed, auto-renewing - CNAME ghs.googlehosted.com www
因为它与这个域名冲突
Type Name Data TTl
CNAME www c.storage.googleapis.com 600 sec
当我将我的 cname 记录更改为 ghs 时,我收到以下错误
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>The requested project was not found.</Details>
</Error>
对于这次编辑造成的混乱,我深表歉意,我对我一直在使用 google 云所做的事情感到非常困惑。我在存储桶中有一个项目,在应用引擎中有另一个项目,但我不知道如何在应用引擎中显示我的 html 或如何从我的 php 执行我的项目存储桶。
这是我在 godaddy 的 DNS 设置的图片
我的 php 遗愿清单的照片
给我发电子邮件的桶的图片
以及在自定义网址下列出的 DNS 设置图片 google 云
您的服务器不允许执行 PHP 脚本并将其呈现为看似只是文本。请咨询您的服务器提供商如何解决此问题。
我是 运行 一个 php 脚本,应该在提交表单时发送电子邮件。当我提交表单时,我收到以下错误。
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>Missing file part</Details></Error>
这是我的html代码
<html lang="en">
<head>
<script src="email_me.php"></script>
<meta charset="utf-8">
</head>
<section class="contact_us1">
<form action="email_me.php" method="post" role="form" aria-label="contact form" enctype="multipart/form-data">
<div>
<input id="field1" aria-invalid="false" name="Name" value="" placeholder="Name" data-aid="nameField" type="text" required>
<input id="field2" aria-invalid="false" name="Email" value="" placeholder="Email" data-aid="emailField" type="text" required>
<input id="field4" aria-invalid="false" name="Subject" value="" placeholder="Subject" data-aid="subjectField" type="text">
</div>
<textarea name="Message" class="message" placeholder="Message" data-aid="messageField" ></textarea>
<button type="submit" >Send</button>
</form>
</section>
这是我的 PHP 脚本
<?php
if($_POST["submit"]) {
$recipient="my@email.com"; //Enter your mail address
$subject=$_POST["Subject"]; //Subject
$sender=$_POST["Name"];
$senderEmail=$_POST["Email"];
$message=$_POST["Message"];
$mailBody="Name: $sender\nEmail Address: $senderEmail\nSubject:$subject\n\nMessage: $message";
mail($recipient, $subject, $mailBody);
sleep(1);
header("Location:http://www.affordtotrip.com/"); // Set here redirect page or destination page
}
?>
我正在使用 google 云作为服务器,为此我创建了一个存储桶。 提交后,我希望发送电子邮件并刷新页面。
更新
我经历了 php tutorial and tried to set up a custom domain
我不知道如何 link 这个 php 项目到我实际的 html 页面。我唯一遇到问题的 DNS 记录是
Custom domain name SSL Security RecordType Data Alias
Google-managed, auto-renewing - CNAME ghs.googlehosted.com www
因为它与这个域名冲突
Type Name Data TTl
CNAME www c.storage.googleapis.com 600 sec
当我将我的 cname 记录更改为 ghs 时,我收到以下错误
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>The requested project was not found.</Details>
</Error>
对于这次编辑造成的混乱,我深表歉意,我对我一直在使用 google 云所做的事情感到非常困惑。我在存储桶中有一个项目,在应用引擎中有另一个项目,但我不知道如何在应用引擎中显示我的 html 或如何从我的 php 执行我的项目存储桶。
这是我在 godaddy 的 DNS 设置的图片
我的 php 遗愿清单的照片
给我发电子邮件的桶的图片
以及在自定义网址下列出的 DNS 设置图片 google 云
您的服务器不允许执行 PHP 脚本并将其呈现为看似只是文本。请咨询您的服务器提供商如何解决此问题。