【发布时间】:2021-04-26 15:32:32
【问题描述】:
您好,我是学习者,我想在我的网站上使用动态联系我们表单,但在尝试使用 HTML/PHP/PEAR 使其动态化时遇到问题 我在这里很困惑如何为与 Mochahost 一起使用的实际表单编写 php 脚本
测试在服务器上运行良好,但我的问题是我不知道如何编写 php 脚本以使其动态化(实际消息来自网页)
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
require_once "Mail/Mail-1.4.1/Mail.php";
$host = "mail.example.com";
$username = "siri@example.com";
$password = "********";
$port = "2525";
$to = "?";
$email_from = " how dynamical i can see the emails here ?";
$email_subject = "how i can get the subject from my email form that user fielded? " ;
$email_body = "want to see the message user types in my inbox ?" ;
$email_address = "?";
$headers = array ('From' => $email_from, 'To' => $to, 'Subject' => $email_subject, 'Reply-To' => $email_address);
$smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
$mail = $smtp->send($to, $headers, $email_body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
【问题讨论】:
标签: javascript php html bootstrap-4