Jump to content

Retrieving emails from database and replying using PHP


vikela

Recommended Posts

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.

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??

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.