Jump to content

Sending mail problem


phpmady

Recommended Posts

Hi

 

Sending mail problem, it going as plain text

<?php

include("global.php");


$Form_ID = $_GET['Form_ID'];
$Page_ID = $_GET['Page_ID'];
$Menu_ID = $_GET['Menu_ID']; 

$website_email = $g_setups[website_email]; 
$website_name = $Language_Website_Name;
$website_link = $g_setups[website_link];




//get the Email Address from the Form Table
#Email Address has taken from the Form Table,(may contain more than 1 email IDS)
$email = "SELECT * FROM form where Form_ID = ".$Form_ID;

$temps_email = $DB_site->query($email);
$temp_email = $DB_site->fetch_array($temps_email);
$add = explode("\n",$temp_email[Form_Email]);
$address_count = count($add);


$f="";
$frm = "SELECT * FROM field where Form_ID = ".$Form_ID;
$temps = $DB_site->query($frm);

while($temp = $DB_site->fetch_array())
{




$value="";




//var_dump($_POST);


//exit();


$nos = count($_POST["a".$temp[Field_ID]]);






if($nos == 1)
{
$value = $_POST["a".$temp[Field_ID]];
}
else
{

for($i=0;$i<$nos;$i++)
{
$value = $value.$_POST["a".$temp[Field_ID]][$i];

}


}


//echo $value;

//exit();



$f = $f."<div style='  background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>".$temp[Field_Name]."</div>".
"<div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>".$value."</div></div>";


}






// Your email subject text
$esubject = "Forms"; 

// Email Content
//Get the Form Field Ids and Form Values  and Mail It

$emailtext = "
<div style='width:500px; height=800px'>
<div style='background-color:gray;'>Form</div>
<div style=''><p>$f</p></div>
</div>

";






$headers = 'From: '.$website_name .'noreply@'.$website_link.'' . "\r\n" .
    'Reply-To: noreply@'.$website_link.'' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();



# This sends the email to you
for($i=0;$i<$address_count;$i++)
{

//@mail("$add[$i]", $esubject, $emailtext, $header);
mail("$add[$i]", $esubject, $emailtext, $header);
//echo "send sucess";
}

echo "<meta http-equiv=Refresh content=1;url='none.php?do=pagelink&Page_ID=$Page_ID&Menu_ID=$Menu_ID&mail_msg=sucess'>";		
exit;


?>

 

Thanks

 

 

Link to comment
Share on other sites

this is the mail mesage am getting as plain text

 

 

<div style='width:500px; height=800px'>

<div style='background-color:gray;'>Form</div>

<div style=''><p><div style='  background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>Name</div><div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>name value</div></div><div style='  background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>Email</div><div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>Email Address Value</div></div><div style='  background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>Sex</div><div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>Male

</div></div><div style='  background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>Country</div><div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>India

</div></div></p></div>

</div>

Link to comment
Share on other sites

mail look at Example #4:

 

Example #4 Sending HTML email

It is also possible to send HTML email with mail().

 

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</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 .= 'From: Birthday Reminder <birthday@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);
?>

 

Sometimes reading the manual helps. :)

Link to comment
Share on other sites

Thank You,

 

 

 

mail look at Example #4:

 

Example #4 Sending HTML email

It is also possible to send HTML email with mail().

 

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</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 .= 'From: Birthday Reminder <birthday@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);
?>

 

Sometimes reading the manual helps. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.