How to handle a member's site email, like email sent back and forth bwtween members?

Thread Solved

Join Date: Mar 2007
Posts: 63
Reputation: websurfer is an unknown quantity at this point 
Solved Threads: 0
websurfer websurfer is offline Offline
Junior Poster in Training

How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #1
Nov 1st, 2008
Hello, all: have this general question on how to handle member's email in a site...

what is the right way to setup an email-system structure, say like in dating site, where members can email between each other, and if a member receives a new email it will "show" new email, and once it is read, then it turns off... member would either receive email notices to their email, or coudl also login in the site to read their email... (like Yahoo too per say)

Not sure how the whole system would be setup... would the emails that are sent back and forth between members be entered into a database, which then will show in each member's email list as send/received email? and if so, how would the site know that an "email" has been read or not? and show appropriate "new" email warning? I am thinking, maybe a conditional statement like "if email present in users[email] field, show "new-mail" icon, else show-nothing"??

Or am I completely off base?

Any feedback much appreciated!
Last edited by websurfer; Nov 1st, 2008 at 11:54 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #2
Nov 2nd, 2008
actually a system like this is quite simple. i have created a few and i am working with one on my newest project.

i can share some of my code once i know how your system is set up so it will easily integrate into your site.
Last edited by kkeith29; Nov 2nd, 2008 at 1:26 am.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 63
Reputation: websurfer is an unknown quantity at this point 
Solved Threads: 0
websurfer websurfer is offline Offline
Junior Poster in Training

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #3
Nov 2nd, 2008
Hi, Keith:

thanks for your reply..
What I was looking for was just a basic idea/framework on how one would go about setting something like this up.. I am trying to learn this language a bit better so wanted to just get basic direction, guidance on how something like is supposed to work so i can try to replicate it...
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #4
Nov 2nd, 2008
ok, well start by setting up a database. i used an inbox, outbox, and message table. after this is created, start making a members area where users need to login. this is so you can tell whos messages need to be displayed. upon completion of that make input forms like the "send message" feature. then make the message display pages.
Last edited by kkeith29; Nov 2nd, 2008 at 1:53 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #5
Nov 2nd, 2008
Personally, I would make a few tables like this: (I will refer to email's (eg someone@example.com) as emails and messages between users as Personal Messages (PM's)
table: users
  1. Column: description
  2. id: unique, auto increment id of user
  3. username: username
  4. password: hash of password
  5. email: users email address
table: PMs
  1. Column: description
  2. id: unique, auto increment id of message
  3. from: user id of who sent the message
  4. to: user id of who the message is to
  5. subject: message subject
  6. message: message content
  7. read: tinyint where 1 means "read" and 0 means unread

I always include an id and use that when referring to rows. On a page that isn't the users "inbox" I would use the query "SELECT `id` FROM `PMs` WHERE to='$user_id' AND read=0" then if a result was returned then you echo a link to their inbox.

In the inbox I'd use "SELECT * FROM `PMs` WHERE to='$user_id'" and the "read" column can be used to, say, display the messages as bold or not bold.

In the outbox I'd use "SELECT * FROM PMs WHERE from='$user_id'" .
"If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 63
Reputation: websurfer is an unknown quantity at this point 
Solved Threads: 0
websurfer websurfer is offline Offline
Junior Poster in Training

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #6
Nov 2nd, 2008
Thanks guys, one more question... I get much of what you are saying, but in the case of Humbug's suggestion. how is the "read" (tinyint) cloumn, suppsoed to indicate, or know to indicate that message has been read or not read? how would it become 0 or 1??

Thanks!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #7
Nov 2nd, 2008
Originally Posted by websurfer View Post
Thanks guys, one more question... I get much of what you are saying, but in the case of Humbug's suggestion. how is the "read" (tinyint) cloumn, suppsoed to indicate, or know to indicate that message has been read or not read? how would it become 0 or 1??

Thanks!
once the member goes to the "view" portion of the code, have it mark the message as read if it is unread. pretty simple.

also, when i was creating my system, which was a lot like humbugs', i found a major flaw. once someone deletes the message from the database, it will delete the message from the senders outbox as well. this is why i used an inbox and outbox table. they both refer to an instance the message table, so you can't delete the message itself.

to fix this problem i used something like this:

  1. #DROP TABLE IF EXISTS `inbox`;
  2. CREATE TABLE IF NOT EXISTS `inbox` (
  3. `in_id` int(11) NOT NULL auto_increment,
  4. `in_mem_id` int(11) NOT NULL default '0',
  5. `in_mess_id` int(11) NOT NULL default '0',
  6. PRIMARY KEY (`in_id`)
  7. );
  8. #DROP TABLE IF EXISTS `messages`;
  9. CREATE TABLE IF NOT EXISTS `messages` (
  10. `mess_id` int(11) NOT NULL auto_increment,
  11. `mess_to` int(11) NOT NULL default '0',
  12. `mess_from` int(11) NOT NULL default '0',
  13. `mess_subject` varchar(200) NOT NULL default '',
  14. `mess_text` longtext NOT NULL,
  15. `unread` int(11) NOT NULL default '0',
  16. `time` int(11) NOT NULL default '0',
  17. PRIMARY KEY (`mess_id`)
  18. );
  19. #DROP TABLE IF EXISTS `outbox`;
  20. CREATE TABLE IF NOT EXISTS `outbox` (
  21. `out_id` int(11) NOT NULL auto_increment,
  22. `out_mem_id` int(11) NOT NULL default '0',
  23. `out_mess_id` int(11) NOT NULL default '0',
  24. PRIMARY KEY (`out_id`)
  25. );

then to keep your database running smoothly, have cron job that will check if a message is not in a members inbox or outbox and if its not delete it.
Last edited by kkeith29; Nov 2nd, 2008 at 12:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 63
Reputation: websurfer is an unknown quantity at this point 
Solved Threads: 0
websurfer websurfer is offline Offline
Junior Poster in Training

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #8
Nov 2nd, 2008
thanks Keith, I think I got the basics of it. Thanks for your feedback.
One more quick question, what is a "cron" job??
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #9
Nov 2nd, 2008
instead of me trying to explain. check out this link: http://en.wikipedia.org/wiki/Cron
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 63
Reputation: websurfer is an unknown quantity at this point 
Solved Threads: 0
websurfer websurfer is offline Offline
Junior Poster in Training

Re: How to handle a member's site email, like email sent back and forth bwtween members?

 
0
  #10
Nov 2nd, 2008
thanks again... gonna check out link
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC