0

我正在尝试将填写好的表格发送到特定的电子邮件地址。但我对此一无所知。我知道一点 PHP 编码,据我在网上学习,我发现 PHP 已经有一个 mail() 函数。但这也有一些问题。尽管我没有正确理解其中的大部分内容。

这是我想做的事情:

  1. 我想将填写好的表格发送到特定的电子邮件地址。
  2. 我想将填写好的表格发送到我的手机,以便我可以立即回复。
  3. 我只想将该邮件发送到我的收件箱(不是垃圾邮件)。

我要求每个人都向我提供有关如何做到这一点的详细信息。

提前致谢..

4

3 回答 3

1

您可以简单地使用带有所有参数的 php 邮件函数,例如邮件 ( $to ,$subject , $message, $headers ); 其中 $to、$subject、$message 是 php 变量以包含它们各自的值。当您从表单中发布数据时,您可以从表单中生成 $message。喜欢 $message = $_POST['FORM_FIELD_NAME'];

和 $headers 根据您的要求设置。例如

$headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: My Name <myemail@address.com>' . "\r\n";

于 2013-09-17T05:49:45.727 回答
0

it can help you..

<?php

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "smtp.example.com"; // SMTP server

$mail->From     = "from@example.com";
$mail->AddAddress("id@example.net");

$mail->Subject  = "First PHPMailer Message";
$mail->Body     = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send()) {
  echo 'Message was not sent.';
  echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
  echo 'Message has been sent.';
}
?>
于 2013-09-17T06:04:33.067 回答
0

Use PHPMailer to send mails in PHP

http://phpmailer.worxware.com/‎</p>

PHPMailer wiki page:

https://code.google.com/a/apache-extras.org/p/phpmailer/wiki/UsefulTutorial

Use can use Gmail, Live or any other SMTP server to send mails Code:

<?php

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "smtp.example.com"; // SMTP server

$mail->From     = "from@example.com";
$mail->AddAddress("myfriend@example.net");

$mail->Subject  = "First PHPMailer Message";
$mail->Body     = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send()) {
  echo 'Message was not sent.';
  echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
  echo 'Message has been sent.';
}

?>

于 2013-09-17T05:47:23.733 回答