Showing posts with label bluehost. Show all posts
Showing posts with label bluehost. Show all posts

Friday, May 25, 2018

PHP Mail Function Working with Bluehost server

Simple code for sending emails that worked is as follows:



<?php
$emailto = 'to@domain.com';
$emailfrom = 'from@domain.com';
$subject = 'Email Subject';
$messagebody = 'Hello.';
$headers =
'From: ' . $emailfrom.' . "\r\n" .
'Reply-To: ' . $emailto . ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($emailto, $subject, $message, $headers);
?>
PHP mail code that works with Bluehost



<?php
$emailto = 'to@domain.com';
$toname = 'TO NAME';
$emailfrom = 'from@domain.com';
$fromname = 'FROM NAME';
$subject = 'Email Subject';
$messagebody = 'Hello.';
$headers =
'Return-Path: ' . $emailfrom . "\r\n" .
'From: ' . $fromname . ' <' . $emailfrom . '>' . "\r\n" .
'X-Priority: 3' . "\r\n" .
'X-Mailer: PHP ' . phpversion() .  "\r\n" .
'Reply-To: ' . $fromname . ' <' . $emailfrom . '>' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-Transfer-Encoding: 8bit' . "\r\n" .
'Content-Type: text/plain; charset=UTF-8' . "\r\n";
$params = '-f ' . $emailfrom;
$test = mail($emailto, $subject, $messagebody, $headers, $params);
// $test should be TRUE if the mail function is called correctly
?>

Product Category Demo in laravel

https://drive.google.com/file/d/1kuyeT3LA22IuN3o_kypOyXesEXMLv31e/view?usp=sharing