phpmady Posted August 22, 2010 Share Posted August 22, 2010 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 https://forums.phpfreaks.com/topic/211438-sending-mail-problem/ Share on other sites More sharing options...
phpmady Posted August 22, 2010 Author Share Posted August 22, 2010 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 https://forums.phpfreaks.com/topic/211438-sending-mail-problem/#findComment-1102409 Share on other sites More sharing options...
premiso Posted August 22, 2010 Share Posted August 22, 2010 mail look at Example #4: Example #4 Sending HTML email It is also possible to send HTML email with mail(). <?php // multiple recipients $to = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; // 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 <[email protected]>, Kelly <[email protected]>' . "\r\n"; $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> Sometimes reading the manual helps. Link to comment https://forums.phpfreaks.com/topic/211438-sending-mail-problem/#findComment-1102419 Share on other sites More sharing options...
phpmady Posted August 22, 2010 Author Share Posted August 22, 2010 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 = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; // 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 <[email protected]>, Kelly <[email protected]>' . "\r\n"; $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> Sometimes reading the manual helps. Link to comment https://forums.phpfreaks.com/topic/211438-sending-mail-problem/#findComment-1102470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.