image not showing in email using php mail - php

I am trying to send email using php code mail is working file but image not coming into the mail. the image src path is coming with encoded string as below
<img style="width:100%" src="https://ci6.googleusercontent.com/proxy/NT6fQckS1LLRnuTUJnW0Fp2qUujk_Cpv9kV1hwoKQADwL8XU7fo4=s0-d-e1-ft#http://header.png" class="CToWUd a6T" tabindex="0">
<?php
$to = $_REQUEST['email'];
$subject = 'Winning prize';
$email_id = 'info#sample.com';
$headers = "From: " . strip_tags($email_id) . "\r\n";
$headers .= "Reply-To: " . strip_tags($email_id) . "\r\n";
$headers .= "CC: satishv#sample.com";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html>
<head>
<title></title>
</head>
<body>
<div style="border:1px solid #e96000; width: 600px;">
<table style="color: #777;font-family: sans-serif;" width="600">
<tr>
<td style="padding:0px 0">
<img style="width: 100%;" src="header.png">
</td>
</tr>
<tr>
<td><span style="font-family: sans-serif;">Hey</span><span style="font-family: sans-serif;margin-left: 5px;">'.$address['customer_name'].'!,</span></td>
</tr>
<tr>
<td style="padding:20px 0 0 20px"><span style="font-family: sans-serif;">Congratualtion! The product is Yours.</span></td>
</tr>
</table>
<table style="color: #777;font-family: sans-serif;text-align: center;" width="600">
<tr>
<td colspan="4" style="padding: 30px 0;border-top: 1px solid #e96000;border-bottom: 1px solid #e96000;"><span>Once Your Package ships we will send your a tracking number Once Your Package ships we will send your a tracking number Once Your Package ships we will send your a tracking number </span></td>
</tr>
</table>
</div>
</body>
</html>';
$result = mail($to, $subject, $message, $headers);
?>
the above code is working file just image not coming into the mail

Most of the email clients block the image. But still, you can show the image. You have to use Absolute image source URL. For an example
<img style="width: 100%;" src="header.png">
change to
<img style="width: 100%;" src="http://www.YourSite.com/header.png">
Please be sure that the image exists in the path.

Related

Warning: fopen(): Filename cannot be empty [duplicate]

Send email with attachment code was working fine recently we have transfer the file to another hosting server idk what happen it display the below error,
Warning: fopen(): Filename cannot be empty in /home/hugerecruitmetnt/public_html/validatecva.php on line 106
Warning: fread() expects parameter 1 to be resource, boolean given in /home/hugerecruitmetnt/public_html/validatecva.php on line 107
Warning: fclose() expects parameter 1 to be resource, boolean given in /home/hugerecruitmetnt/public_html/validatecva.php on line 148
Warning: Cannot modify header information - headers already sent by (output started at /home/hugerecruitmetnt/public_html/validatecva.php:106) in /home/hugerecruitmetnt/public_html/validatecva.php on line 150
<?php
$name = $_POST['fname'];
$initial = $_POST['mname'];
$surname = $_POST['lname'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$nationality = $_POST['nationality'];
$address = $_POST['fulladdress'];
$passport = $_POST['passportno'];
$passexpiry = $_POST['passexpiry'];
$mobile = $_POST['mobile'];
$email_address = $_POST['email'];
$filename=$_FILES["newfile"]["name"];
$filetype=$_FILES["newfile"]["type"];
$filesize=$_FILES["newfile"]["size"];
$filetemp=$_FILES["newfile"]["tmp_name"];
if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword" or $filetype=="application/zip" or $filetype=="application/pdf" or $filetype=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
{
$message= '<table cellspacing="0" cellpadding="8" border="0" width="400">
<tr>
<td colspan="2"></td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$fname.' '.$initial.' '.$surname.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Gender</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$gender.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Date Of Birth</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$dob.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>nationality</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$nationality.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Address</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$fulladdress.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Passport No</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$passportno.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Passport Expiry</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$passexpiry.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Email</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$email.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Mobile</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$mobile.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
</table>
';
// MAIL SUBJECT
$subject = "Posted CV From ";
// TO MAIL ADDRESS
$to = 'email#email.com';
/*
// MAIL HEADERS
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Name <name#name.com>\n";
*/
// MAIL HEADERS with attachment
$fp = fopen( $newfile, "rb");
$file = fread($fp, $newfile_size);
$file = chunk_split(base64_encode($file));
$num = md5(time());
//Normal headers
$headers = "From: $name<$email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."\r\n";
$headers .= "--$num\r\n";
// This two steps to help avoid spam
$headers .= "Message-ID: <".$now." TheSystem#".$_SERVER['SERVER_NAME'].">\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
// With message
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n";
// Attachment headers
$headers .= "Content-Type:".$newfile_type." ";
$headers .= "name=\"".$newfile_name."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"".$newfile_name."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";
// SEND MAIL
#mail($to, $subject, $message, $headers);
fclose($fp);
header('Location: thankscv.php');
}
else
{
echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#F3363F; font-weight:bold">Wrong file format. Mail was not sent.</font>';
//echo "<script>window.location.href='careers.html';</script>";
}
Problem Solved
to hide the warning just use "#"
ex: #fopen, #fread, #fclose
Phew 3hrs wasted to solve this warning
Default size of uploading temp file is 2mb
Increase Size By
upload_max_filesize=2M
TO
upload_max_filesize=100M
in php.ini xampp, and after that restart xampp. I hope you will not get any errors and that the file will be read also.

PHP mail send very slowly

I have a VPS with inmotion hosting, and i send a confirmation email, but the email it takes too mucho to send, how is the best way to estructure the html code when i send a mail, how can i boost the performance.
This is my code.
$subject = 'Mail activation';
$body = '
<html>
<head>
<base target="_blank">
</head>
<body>
<table style="max-width:800px; margin:0 auto; font-family: Arial, Helvetica, sans-serif;" cellspacing="0" cellpadding="10">
<thead style="border-bottom:1px solid #DDD;">
<tr>
<td align="center" style="border-bottom:1px solid #DDD;">
<img src="http://p.unid.com/img/logoSASENegro.png" alt="" height="45" width="150"/>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
Hi classmate
</td>
</tr>
<tr>
<td>
Press the following link.
</td>
</tr>
<tr>
<td>
www.google.com
</td>
</tr>
<tr>
<td>
You data:
</td>
</tr>
<tr>
<td>
ID - <b>'.$ids.'</b><br/>
Password - <b>'.$pass.'</b><br/>
</td>
</tr>
<tr>
<td>
Don't response this email.
</td>
</tr>
</tbody>
</table>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Contacto SASE <atencionsase#unid.mx>\r\n";
if(mail($emailC, $subject, $body, $headers))
On some servers mail() sent emails really slow. Your issue is not related to message content, but it related to your hosting provider. As a possible solution, you can just switch your script to sending mail via different SMTP server (for example gmail: Send email using the GMail SMTP server from a PHP page).

How to send email include html code using php? [duplicate]

This question already has an answer here:
How to send mail using php by insert html into mail content? [duplicate]
(1 answer)
Closed 7 years ago.
How to send email include html code using php ?
I tried to use this code.
<?PHP
include("connect.php");
$email = "test_mail#hotmail.com";
$to = $email;
$subject = "test subject";
$message = "
<body style='margin: 0; padding: 0;'>
<table border='1' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td>
<img src='http://i.stack.imgur.com/Jy9QUm.jpg'/>
</td>
</tr>
<tr>
<td>
test text
</td>
</tr>
</table>
</body>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: EXAMPLE <noreply#example.com>' . "\r\n";
$headers .= 'Return-Path: return#example.com' . "\r\n";
mail($to, $subject, $message, $headers, '-freturn#example.com');
?>
When i open my email it's will show like this in my email.
<body style='margin: 0; padding: 0;'>
<table border='1' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td>
<img src='http://i.stack.imgur.com/Jy9QUm.jpg'/>
</td>
</tr>
<tr>
<td>
test text
</td>
</tr>
</table>
</body>
But i want to show like this
How can i do ?
........................................................................................................................................................
Reason being is, that you don't have <!doctype html> and </html> tags (and other tags) and your HTML isn't being rendered as proper/full HTML markup.
$message = "
<!doctype html>
<html>
<head>
<title></title>
</head>
<body style='margin: 0; padding: 0;'>
<table border='1' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td>
<img src='http://i.stack.imgur.com/Jy9QUm.jpg'/>
</td>
</tr>
<tr>
<td>
test text
</td>
</tr>
</table>
</body>
</html>
";
Which upon testing afterwards, was successful.
Foonotes: (edit)
Even though I placed an answer, I decided to close the question being an exact duplicate of their other question How to send mail using php by insert html into mail content? where they were also nonrespondant and the answer given in there, answered what they posted for code.

php error fopen(): Filename cannot be empty in

Send email with attachment code was working fine recently we have transfer the file to another hosting server idk what happen it display the below error,
Warning: fopen(): Filename cannot be empty in /home/hugerecruitmetnt/public_html/validatecva.php on line 106
Warning: fread() expects parameter 1 to be resource, boolean given in /home/hugerecruitmetnt/public_html/validatecva.php on line 107
Warning: fclose() expects parameter 1 to be resource, boolean given in /home/hugerecruitmetnt/public_html/validatecva.php on line 148
Warning: Cannot modify header information - headers already sent by (output started at /home/hugerecruitmetnt/public_html/validatecva.php:106) in /home/hugerecruitmetnt/public_html/validatecva.php on line 150
<?php
$name = $_POST['fname'];
$initial = $_POST['mname'];
$surname = $_POST['lname'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$nationality = $_POST['nationality'];
$address = $_POST['fulladdress'];
$passport = $_POST['passportno'];
$passexpiry = $_POST['passexpiry'];
$mobile = $_POST['mobile'];
$email_address = $_POST['email'];
$filename=$_FILES["newfile"]["name"];
$filetype=$_FILES["newfile"]["type"];
$filesize=$_FILES["newfile"]["size"];
$filetemp=$_FILES["newfile"]["tmp_name"];
if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword" or $filetype=="application/zip" or $filetype=="application/pdf" or $filetype=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
{
$message= '<table cellspacing="0" cellpadding="8" border="0" width="400">
<tr>
<td colspan="2"></td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$fname.' '.$initial.' '.$surname.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Gender</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$gender.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Date Of Birth</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$dob.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>nationality</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$nationality.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Address</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$fulladdress.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Passport No</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$passportno.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Passport Expiry</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$passexpiry.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Email</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$email.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Mobile</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$mobile.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
</table>
';
// MAIL SUBJECT
$subject = "Posted CV From ";
// TO MAIL ADDRESS
$to = 'email#email.com';
/*
// MAIL HEADERS
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Name <name#name.com>\n";
*/
// MAIL HEADERS with attachment
$fp = fopen( $newfile, "rb");
$file = fread($fp, $newfile_size);
$file = chunk_split(base64_encode($file));
$num = md5(time());
//Normal headers
$headers = "From: $name<$email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."\r\n";
$headers .= "--$num\r\n";
// This two steps to help avoid spam
$headers .= "Message-ID: <".$now." TheSystem#".$_SERVER['SERVER_NAME'].">\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
// With message
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n";
// Attachment headers
$headers .= "Content-Type:".$newfile_type." ";
$headers .= "name=\"".$newfile_name."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"".$newfile_name."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";
// SEND MAIL
#mail($to, $subject, $message, $headers);
fclose($fp);
header('Location: thankscv.php');
}
else
{
echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#F3363F; font-weight:bold">Wrong file format. Mail was not sent.</font>';
//echo "<script>window.location.href='careers.html';</script>";
}
Problem Solved
to hide the warning just use "#"
ex: #fopen, #fread, #fclose
Phew 3hrs wasted to solve this warning
Default size of uploading temp file is 2mb
Increase Size By
upload_max_filesize=2M
TO
upload_max_filesize=100M
in php.ini xampp, and after that restart xampp. I hope you will not get any errors and that the file will be read also.

What is wrong with my PHP email code; it won't redirect to thank you page [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
Curious as to what is wrong with the following php code which sends an email when a contact form is filled out and submitted. The email arrives perfectly but instead of redirecting it gives the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home4/ranchoba/public_html/marvan/marvan/send.php:1) in /home4/ranchoba/public_html/marvan/marvan/send.php on line 112
I've tried calling the php file by the action in the form as well as by placing a in the very first line of the page. Neither one works.
PHP Code:
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
//if the form is submitted, go ahead and send the email to ops
ob_start();
if ($_POST['is_form_submitted'] == "yes")
{
//Send email to ops of this request-----------------------------------------------------------------------------------
// multiple recipients
$to = 'blah#gmail.com';
// subject
$subject = "Contact Request: ".$_POST['name'];
// message
$message = '
<html>
<head>
<title>Re: Marvan Site Contact Request</title>
<style type="text/css">
<!--
.style4 {font-family: Arial, Helvetica, sans-serif; font-size: 12; }
.style5 {font-size: 12}
.style6 {font-family: Arial, Helvetica, sans-serif; font-size: 12; font-weight: bold; }
-->
</style>
</head>
<body>';
$message=$message.'
<table width="450" border="0" align="center" cellpadding="4" cellspacing="0" style="border-color:#CCCCCC; border-style:solid; border-width:1px; background-color:#FFFFFF; padding-top:3px;">
<tr>
<td width="430" style="height:auto;" valign="top">';
$message=$message.'<img src="http://www.blah.com/blah/images/logo.png">';
$message=$message.'<hr>';
$message=$message.'<h2 style="font-family:Arial, Helvetica, sans-serif; color:#B58736">Contact Request </h2>';
$message=$message.'
<table width="486" border="0" align="center" cellpadding="4" cellspacing="2">
<tr>
<td colspan="4" valign="top"><div align="left" class="style4"><span style="color:#000000; font-weight:bold;">Contact Details: </span></div></td>
</tr>
<tr>
<td width="145" valign="top"><div align="left" class="style4">Name :</div></td>
<td width="1" valign="top"><span class="style5"></span></td>
<td width="984" colspan="2" valign="top"><div align="left" class="style6">';
$message = $message. $_POST['name'];
$message = $message.'</div></td>
</tr>
<tr>
<td valign="top"><div align="left" class="style4">Email :</div></td>
<td valign="top"><span class="style5"></span></td>
<td colspan="2" valign="top"><div align="left" class="style6">';
$message = $message. $_POST['email'];
$message = $message.'</div></td>
</tr>
<tr>
<td valign="top"><div align="left" class="style4">Subject :</div></td>
<td valign="top"><span class="style5"></span></td>
<td colspan="2" valign="top"><div align="left" class="style6">';
$message = $message. $_POST['subject'];
$message = $message.'</div></td>
</tr>
<tr>
<td valign="top"><div align="left" class="style4">Phone :</div></td>
<td valign="top"><span class="style5"></span></td>
<td colspan="2" valign="top"><div align="left" class="style6">';
$message = $message. $_POST['phone'];
$message = $message.'</div></td>
</tr>
<tr>
<td valign="top"><div align="left" class="style4">Message :</div></td>
<td valign="top"><span class="style5"></span></td>
<td colspan="2" valign="top"><div align="left" class="style6">';
$message = $message. $_POST['message'];
$message = $message.'</div></td>
</tr>';
$message = $message.'
<tr> <tr><td colspan="4" valign="top"><span class="style5"></span></td>
</tr>';
$message = $message.'
</table>
<br /></td>
</tr>
</table>
<p> </p>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
/* $headers .= 'To: Mary <mary#example.com>, Kelly <kelly#example.com>' . "\r\n";*/
/* $headers .= 'Cc: birthdayarchive#example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck#example.com' . "\r\n";*/
// Mail it
mail($to, $subject, $message, $headers);
//end of Send Email to Client --------------------------------------------------------------
//redirect to the thank you page
header('Location: http://www.blah.com/blah/thank-you.php');
} //end of if ($_POST['is_form_submitted'] == "yes")
?>
Maybe you have space before <?php tag in your scripts. Check it please and remove them. Also use UTF-8 file encoding without BOM
It is best to find where you are outputting a space or line that is causing the header() to fail. But if you cannot, try this to clear the buffer before header().
if (ob_get_length() > 0 ) {
ob_clean();
flush();
}

Categories