从AWS S3发送邮件时遇到问题

时间:2018-10-17 14:55:38

标签: html amazon-web-services smtp sendmail amazon-ses

我是AWS和PHP的新手。 我在尝试在静态s3站点上设置基本发送表单时遇到问题。

错误 405方法不允许 代码:MethodNotAllowed 消息:不允许对此资源使用指定的方法。 方法:开机自检 资源类型:对象 RequestId:B41697D6C61AFFCE HostId:imaELAWJKISLaPfU1tAbhFaIPAgoRxoUsU7JMcc / x9MSS5SOrU6LiW8sVuS4jTw + d2SdWdbjHQ4 =

PHP

   <?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "support@website.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

HTML

            <form method="post" action="#">
                                        <div class="fields">
                                            <div class="field half">
                                                <label for="name">Name</label>
                                                <input type="text" name="name" id="name" />
                                            </div>
                                            <div class="field half">
                                                <label for="email">Email</label>
                                                <input type="text" name="email" id="email" />
                                            </div>
                                            <div class="field">
                                                <label for="message">Message</label>
                                                <textarea name="message" id="message" rows="5"></textarea>
                                            </div>
                                        </div>
                                        <ul class="actions">
                                            <li><a href="" class="button submit">Send Message</a></li>
                                        </ul>
                                    </form>


Can you point me in the right direction?

1 个答案:

答案 0 :(得分:2)

PHP不是静态的。您只能从S3提供静态资源。您无法在S3上运行PHP代码。