Can not get mail function to work

the mail() function

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Feb 18, 2017 10:07 pm

Sat Feb 18, 2017 10:11 pm

Hello. I am new to php but not to programming. I am trying to use a mail script but can not get it to work. It sends the email just fine but I am trying to format it as an html email. When I receive it the email is blank. Can anyone tell me where i am screwing up? Thanks if you can help

$to = $_POST['toemail'];
$subject = $_POST['subject'];
$message = '<html><body>';
$message .= '<h1 style="color:#f40;">Hi</h1>';
$message .= '<p style="color:#080;font-size:18px;">test</p>';
$message .= '</body></html>';
$fromemail = $_POST['fromemail'];
$fromname = $_POST['fromname'];
$lt= '<';
$gt= '>';
$sp= ' ';
$from= 'From:';
$headers = $from.$fromname.$sp.$lt.$fromemail.$gt;
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

Post Reply