wmguk Posted June 1, 2008 Share Posted June 1, 2008 Hey, My email code is: $mail->setHTML('<body style="font-family:Verdana, Verdana, Geneva, sans-serif; font-size:8px; background-color: #666666;"> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td height="80" align="left" valign="top" background="top.jpg"><p> </p></td></tr><tr><td align="left" valign="top" background="middle.jpg"> <table width="800" border="0" cellspacing="0" cellpadding="0"><tr><td width="20"> </td> <td class="main">' . $title . ', <p>Your guestbook has been written in.</p> <p>You need to view and authorise this message so other people can view the message.</p> <p>Please click <a href="https://www.domain.co.uk/">HERE</a> to log in.</p> <p>Your account details are Album Name: <strong><em>' . $login . '</em></strong> and Email Address: <em><strong>' . $email . '</strong></em>.</p> <p>Once you have logged in, simply click on guestbook and you can read and authorise the message. You will get this email every time someone leaves a message for you, However this isnt instant and can take anytime from minutes to hours, because of our SPAM checking proceedures.</p> <p>Hope everything is well.</p> <p>Regards.<br> Photography.</p> </td><td width="20> </td></tr></table></td></tr> <tr><td align="left" valign="top" background="bottom.jpg"> </td></tr></table> </body>'); however when i get the email the font isnt formatted and the tables and images dont work any thoughts? Link to comment https://forums.phpfreaks.com/topic/108293-formatting-disappears/ Share on other sites More sharing options...
trq Posted June 1, 2008 Share Posted June 1, 2008 Can we see your call to mail() ? Are you setting the correct headers to send an html email? Link to comment https://forums.phpfreaks.com/topic/108293-formatting-disappears/#findComment-555194 Share on other sites More sharing options...
wmguk Posted June 1, 2008 Author Share Posted June 1, 2008 this is the whole script: <?php session_start(); if (!isset($_SESSION['myusername'])) { header("location:index.php"); exit; } $user = $_SESSION['myusername']; ?> <?PHP //Get the data to update $id = $_POST['id']; $login = $_POST['login']; // Make Connection include 'connection.php'; if (!$con) { die('Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); //Run the update query $sql = "UPDATE guestbook SET iwauth = 'yes' WHERE id = '$id'"; mysql_query( $sql , $con ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" ); $result3 = mysql_query("SELECT * FROM our_info WHERE username = '$user'") or die(mysql_error()); while($row = mysql_fetch_array($result3)) { $fromemail = $row['email']; $contact = $row['contact']; $result2 = mysql_query("SELECT * FROM album WHERE login = '$login'") or die(mysql_error()); while($row = mysql_fetch_array($result2)) { $toemail = $row['email']; $groom_firstname = $row['groom_firstname']; $groom_surname = $row['groom_surname']; $bride_firstname = $row['bride_firstname']; $bride_surname = $row['bride_surname']; $title = $row['albumname']; $login = $row['login']; //EMAIL require_once('email/htmlMimeMail5.php'); $mail = new htmlMimeMail5(); /** * Set the from address */ $mail->setFrom('' . $contact . '- Photography <' . $fromemail . '>'); /** * Set the prority */ $mail->setPriority('normal'); /** * Set the subject */ $mail->setSubject('You have a guestbook message'); /** * Set the text of the Email */ $mail->setText('Sample text'); /** * Set the HTML of the email */ $mail->setHTML('<body style="font-family:Verdana, Verdana, Geneva, sans-serif; font-size:12px; background-color: #666666;"> <p>' . $title . ',<br> Your guestbook has been written in.</p> <p>You need to view and authorise this message so other people can view the message.</p> <p>Please click <a href="https://www.iwphoto.co.uk/">HERE</a> to log in.</p> <p>Your account details are Album Name: <strong><em>' . $login . '</em></strong> and Email Address: <em><strong>' . $toemail . '</strong></em>.</p> <p>Once you have logged in, simply click on guestbook and you can read and authorise the message. You will get this email every time someone leaves a message for you, However this isnt instant and can take anytime from minutes to hours, because of our SPAM checking proceedures.</p> <p>Hope everything is well.</p> <p>Regards.<br> Photography.</p> </body>'); /** * Add an embedded image */ $mail->addEmbeddedImage(new fileEmbeddedImage('../images/frameset/top.jpg')); $mail->addEmbeddedImage(new fileEmbeddedImage('../images/frameset/middle.jpg')); $mail->addEmbeddedImage(new fileEmbeddedImage('../images/frameset/bottom.jpg')); /** * Send the email */ $mail->send(array('' . $toemail . '')); } } //Close the connection mysql_close($con); //<META HTTP-EQUIV="Refresh" CONTENT="0; URL=../guestbook.php"> ?> Link to comment https://forums.phpfreaks.com/topic/108293-formatting-disappears/#findComment-555202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.