php mail in object oriented

I want to send mail through php code.I’m familiar with procedural but I’m newbie to object oriented(OOP).My mailing code is working well in procedural bt not in OOP.

include "config.php";
 $sql = $conn->query("insert into message(name,email,phone,message) values ('$name','$email','$phone','$message')");

 $from = $email;
     $to= '';
     $headers1 = "From: $fromn";
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,

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

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.