面向对象的{php}邮件

时间:2015-07-10 07:17:20

标签: php oop

我想通过php代码发送邮件。我熟悉程序,但我是面向对象(OOP)的新手。我的邮件代码在程序方面运行良好而不是在OOP中。

if(isset($_REQUEST['send']))
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$phone=$_REQUEST['phone'];
$message=$_REQUEST['message'];
include "config.php";
 $sql = $conn->query("insert into message(name,email,phone,message) values ('$name','$email','$phone','$message')");

 $from = $email;
     $to= 'web@gmail.com';
     $headers1 = "From: $from\n";
echo     $body = "
 Hello Sir,
 I request you to give authority to access parkintrade website as guest     user.

  user Details
   Name    : $name
   Email   : $email
   Phone   : $phone
   message : $message
 ";
  $body.="\nThis is an auto generated email so please do not reply to this email.
  Thank you,
  $name\n";

 echo  $sentmail = mail( $to,"Welcome ", $body, $headers1 );
}

1 个答案:

答案 0 :(得分:0)

使用PHPMailer启发自己。