php email send script emailing codes along with email conten

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
explorer976
Forum Newbie
Posts: 2
Joined: Sun Aug 29, 2010 6:45 am

php email send script emailing codes along with email conten

Post by explorer976 »

Hello,

I hope someone can help. I am not proficient in php or much of html!

The contact form on my website sends the emails with the form contents via php script. However, when I tried to change the email address, I must have changed something and now the form contents include the php script codes.

I will post both the php script and the email content here. I have tried looking up on internet but nothing makes much sense to me!!

Thanks!!!


mail_send.php


<?php
ob_start();
session_start();
if(isset($_POST['enter']) && $_POST['enter']==1)
{
$_SESSION['fname']=$_POST['fname'];
$_SESSION['email']=$_POST['email'];
$to="meritinternational@rogers.com";
$subject='Contact Form';
$message= "<style>

.textstyle{

font-family:Tahoma;

font-size:11px;

color:#156E00;

text-align:left;

margin-left:10px;

text-decoration:none;
}

</style>";

$message.="<table width=400 border=0>

<tr><td class=textstyle>First Name: </td> <td class=textstyle>".$_POST['fname']."</td></tr>
<tr><td class=textstyle>Last Name: </td> <td class=textstyle>".$_POST['lname']."</td></tr>
<tr><td class=textstyle>E-mail address: </td> <td class=textstyle>".$_POST['email']."</td></tr>
<tr><td class=textstyle>Comment: </td> <td class=textstyle>".$_POST['comment']."</td></tr>
</table>";
$mail_from = "From:meritinternational@rogers.com";
$mail_from .="rnContent-type: text/html";
@mail($to,$subject,$message,$mail_from);
header("location: contactthanks.html");
exit();
}

?>


EMAIL that I receive when someone fills the contact form on the website-

<style>

.textstyle{

font-family:Tahoma;

font-size:11px;

color:#156E00;

text-align:left;

margin-left:10px;

text-decoration:none;
}

</style><table width=400 border=0>

<tr><td class=textstyle>First Name: </td> <td class=textstyle>Brett Babb</td></tr>
<tr><td class=textstyle>Last Name: </td> <td class=textstyle>Brett Babb</td></tr>
<tr><td class=textstyle>E-mail address: </td> <td class=textstyle>backyjack6@gmail.com</td></tr>
<tr><td class=textstyle>Comment: </td> <td class=textstyle>Do you wish you could increase your online leads? We have helped a lot of businesses thrive in this market and we can help you! Simply hit reply and I’ll share with you the cost and the benefits.
</td></tr>
</table>
User avatar
iijb
Forum Commoner
Posts: 43
Joined: Wed Nov 26, 2008 11:34 pm

Re: php email send script emailing codes along with email co

Post by iijb »

Hi,
I think you have to change this line in the code

Code: Select all

$mail_from = "From:meritinternational@rogers.com";
$mail_from .="rnContent-type: text/html";
to something like this

Code: Select all

$mail_from = "From:meritinternational@rogers.com" . "\r\n";
$mail_from .="Content-type: text/html";
try this.

Regards
iijb
explorer976
Forum Newbie
Posts: 2
Joined: Sun Aug 29, 2010 6:45 am

Re: php email send script emailing codes along with email co

Post by explorer976 »

Hi,

Thanks soo much for your reply. Will try this and let you know.

Thanks again!!
Post Reply