vikela Posted March 5, 2009 Share Posted March 5, 2009 how can i retrieve and respond to emails in mysql db.i created a db for emails now i want to use php to retrieve mails 1 by 1 then responding or deleting the mails.help m new to php Quote Link to comment https://forums.phpfreaks.com/topic/148080-retrieving-emails-from-database-and-replying-using-php/ Share on other sites More sharing options...
elflacodepr Posted March 5, 2009 Share Posted March 5, 2009 to retrieve your email you will need a query like this: <?php $sql = "SELECT * FROM emails ORDER BY subject ASC"; $query = mysql_query($sql); if (!$query) { // Handle error echo 'Query failed. SQL: ', $sql, '<br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } ?> Remember to change "emails" to your table name and "subject" to the column you want the query to be ordered. Quote Link to comment https://forums.phpfreaks.com/topic/148080-retrieving-emails-from-database-and-replying-using-php/#findComment-777434 Share on other sites More sharing options...
vikela Posted March 6, 2009 Author Share Posted March 6, 2009 i did put your code and nothing is coming out???it now looks like this: $sql = "SELECT * FROM Email_Inb";// ORDER BY subject ASC"; $query = mysql_query($sql); if (!$query) { // Handle error echo 'Query failed. SQL: ', $sql, '<br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } while($row=mysql_fetch_array($query)){ echo "<br/ >Member ID:".$row['member_id']."<br /> Email Message:".$row['emailmsg']."<br />Received Date: ".$row['recdate']."<br />main ID:".$row['main_id']. "<br />"; }; ?> I would also like to add a reply action on each mail i read or send it to a different table?? Quote Link to comment https://forums.phpfreaks.com/topic/148080-retrieving-emails-from-database-and-replying-using-php/#findComment-777934 Share on other sites More sharing options...
fenway Posted March 9, 2009 Share Posted March 9, 2009 No errors? If you have php questions, post in the appropriate section. Quote Link to comment https://forums.phpfreaks.com/topic/148080-retrieving-emails-from-database-and-replying-using-php/#findComment-780140 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.