Search
 
SCRIPT & CODE EXAMPLE
 

PHP

send email template via php

<?php
$to = 'user@example.com';
$subject = "Send HTML Email Using PHP";

$htmlContent = '
<html>
<body>
    <h1>Send HTML Email Using PHP</h1>
    <p>This is a HTMl email using PHP by CodexWorld</p>
</body>
</html>';

// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";

// Additional headers
$headers .= 'From: CodexWorld<info@codexworld.com>' . "
";
$headers .= 'Cc: welcome@example.com' . "
";
$headers .= 'Bcc: welcome2@example.com' . "
";

// Send email
if(mail($to,$subject,$htmlContent,$headers)):
    $successMsg = 'Email has sent successfully.';
else:
    $errorMsg = 'Email sending fail.';
endif;
?>
Comment

create email template php

$variables = array();

$variables['name'] = "Robert";
$variables['age'] = "30";

$template = file_get_contents("template.html");

foreach($variables as $key => $value)
{
    $template = str_replace('{{ '.$key.' }}', $value, $template);
}

echo $template;
Comment

php mail template

php artisan make:mail MensagemTesteMail --markdown emails.mensagem-teste
Comment

PREVIOUS NEXT
Code Example
Php :: php artisan make :migration with model 
Php :: php get first day of month 
Php :: laravel request get parameter 
Php :: wordpress how to match password 
Php :: laravel Please provide a valid cache path 
Php :: Access-Control-Allow-Origin php laravel 
Php :: laravel create controller 
Php :: check if post exists by id wordpress 
Php :: php replace br 
Php :: how to upload two files on same form different path in codeigniter 
Php :: laravel model wherein 
Php :: php path in ubuntu 
Php :: php find if string contains words from list index 
Php :: laravel update email unique 
Php :: create array php 
Php :: how to send mail in laravel 
Php :: unset php return array 
Php :: sql update row in php 
Php :: add brackets to string php 
Php :: protected gaurded in laravel 
Php :: php apply function to array elements 
Php :: python to php 
Php :: get current locale laravel 
Php :: laravel fontawesome 
Php :: Multiple image upload with CodeIgniter 
Php :: laravel crud generator 
Php :: php mail if successful 
Php :: route() and with() in laravel 
Php :: php key value array to string 
Php :: php shortcode wordpress return content with shortcodes 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =