我有一个相当基本的php表单,它在同一页面上提交,称为“registration.php”。我将它设置为收集表单数据,将其存储在$ to,$ subject和$ body变量中,然后我调用mail()方法向我自己发送电子邮件。
请参阅下面的代码(别担心!有一个问题,直到!):
<?php
ob_start(); //output buffering because I like it.
if (isset($_POST['submit'])) {
// Process the form
$message = "Thank you for registering! We will respond to your request shortly";
$name = $_POST['name'];
$email = $_POST['email'];
$address = $_POST['address'];
$comments = $_POST['userComment'];
$date = gmdate("M d Y");
$to = "myemail@outlook.com";
$subject = "Registration Submission";
$body = " Date: $date \n Registrant Name/Name's: $name \n Registrant E-mail: $email \n \n User Comments: \n $comments \n \n";
mail($to,$subject,$body);
}
?>
<form id="contactForm" name="contactForm" action="registration.php" method="post">
<table>
<tr>
<td><label for="name"><strong>Registrant Name / Names</strong></label></td>
<td><input required='required' type="text" id="name" name="name" /></td>
</tr>
<tr>
<td><label for="email"><strong>Registrant E-mail</strong></label></td>
<td><input required='required' type="email" maxlength="40" id="email" name="email" /></td>
</tr>
<tr>
<td><label for="subject"><strong>Registrant Address</strong></label></td>
<td><input required='required' type="text" maxlength="100" id="address" name="address" /></td>
</tr>
<tr>
<td>Message:</td>
<td> </td>
</tr>
<tr>
<td id="textAreaInput" colspan="2"><textarea rows="3" id="userComment" name="userComment" placeholder="Let us know your thoughts!"></textarea></td>
</tr>
</table>
<br />
<button type="submit" name="submit" id="submit">Submit</button>
</form>
我想知道的是,我是否可以使用自定义消息向用户收集的电子邮件收集自定义回复邮件?我可以通过mail()方法发送其他变量吗?比如$ to2,$ subject2,$ body2或者必须将它们命名为$ to,$ subject&amp; $ body过去了吗?
我有一个使用PHPMailer的工作解决方案:
https://github.com/PHPMailer/PHPMailer
我很好奇是否有一个使用PHP的简单过程不依赖于所需的库。
答案 0 :(得分:0)
我认为你所要做的就是
mtnIntent.setAction(Long.toString(System.currentTimeMillis()));