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.

Link to comment
Share on other sites

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

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.