Enter Keyword Hear for Search This Blog

Showing posts with label How to send mail using php code. Show all posts
Showing posts with label How to send mail using php code. Show all posts

Sunday, 18 February 2018

How to send mail using php code

<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Email sent!'
);

    $name = @trim(stripslashes($_POST['fnm']));
    $name = @trim(stripslashes($_POST['lnm'])); 
    $email = @trim(stripslashes($_POST['email'])); 
    $email = @trim(stripslashes($_POST['subject'])); 
    $message = @trim(stripslashes($_POST['message'])); 

    $email_from = $email;
    $email_to = 'email@gmail.com';

    $body = 'fName: ' . $fnm . "\n\n" . 'lName: ' . $lnm . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

    $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

    echo json_encode($status);
    die;
?>

Featured post

what is ajax?how to create ajax with php code

Ajax Introduction -  એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો...