ngreenwood6 Posted September 16, 2008 Share Posted September 16, 2008 I am trying to figure out how to pull emails into the database and then display them. I know how to display information from the database. What I want is to be able to get emails from an email address and enter all the information into the database. For example if test user([email protected]) sends an email to me([email protected]) I want my website to pick it up and enter the sender, subject and message into the database so that I may read all the emails in the database from my website. Also, If possible I would also like to be able to delete them from the webserver as well, not just the database. If anyone can give me an example or a tutorial that would be great. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/124529-mail/ Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 Your talking about a POP3 or IMAP client. There might some code already, check the PEAR libraries. But basically you can just use a socket, see those links above, read the RFC's and then i'd have a play with telnet... Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643126 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 The easy way round.......... when a users sends a message from your message script then keep a copy.............. that easyer............ if you want all emails sent to you to be displayed on a page then you use sockets... but if you want other peoples emails sent to you, your need to get there email account and password and there permission to do that.......... The only way possable to do this and legal way is if you own the email server and all the people sending emails are on your email server then it all legal with permission off course........ still neeed to use sockes..... Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643128 Share on other sites More sharing options...
ngreenwood6 Posted September 16, 2008 Author Share Posted September 16, 2008 Know I want all of my emails sent to my website so that I can display them on a page. Then I can just go into my site and reply to the emails that were sent to me. How would I use sockets? Can you post a link to a tutorial or an example would be helpful too? Thanks for the response Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643133 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 One min your telling me that you havent programmed a privert message system for your mail on your server to get messages... In over words your using a 3rd party email provider like hotamil to get your mesaages that what u mean......... your have to use a pop or imap in php but it a lot easer just to setup a pm system you own then send replys..... Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643141 Share on other sites More sharing options...
DarkWater Posted September 16, 2008 Share Posted September 16, 2008 The easy way round.......... when a users sends a message from your message script then keep a copy.............. that easyer............ if you want all emails sent to you to be displayed on a page then you use sockets... but if you want other peoples emails sent to you, your need to get there email account and password and there permission to do that.......... The only way possable to do this and legal way is if you own the email server and all the people sending emails are on your email server then it all legal with permission off course........ still neeed to use sockes..... Dude, what in the world are you talking about? He can use e-mails sent to him however he wants...what are you talking about with "getting their e-mail account and password"? Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643142 Share on other sites More sharing options...
DarkWater Posted September 16, 2008 Share Posted September 16, 2008 Also, he doesn't want PMs, he wants to check his personal e-mails. o_O Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643144 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 read this your be happy trust me........ http://www.tutorialhero.com/click-27324-livethunder%27s_private_messaging_system.php Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643146 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 Know I want all of my emails sent to my website so that I can display them on a page. Then I can just go into my site and reply to the emails that were sent to me. A simple way could be to have the email server to redirect / forward the emails to a php script which parses them into your database, not sure if this is possible though... otherwise goto google and enter telnet and email... here's two examples: http://members.tripod.com/~smanage/tel.html http://www.trap17.com/index.php/sending-receiving-email-via-telnet_t34702.html Have a hack with those, then here's the main page for php sockets, basically there the same functions as for any bsd style sockets... http://uk2.php.net/manual/en/book.sockets.php Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643147 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 I want my website to pick it up and enter the sender, subject and message into the database if u got a website then why issint it correct to setup your own pm system seems a lot easer to me .......... am i going mad lol Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643150 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 read this your be happy trust me........ http://www.tutorialhero.com/click-27324-livethunder%27s_private_messaging_system.php If this is what your after and your going to use it. Make sure that the function can only be called from certain (members only) pages, so others can't spam etc... Theres a few other feature it could do with as well, otherwise quite nice and capable. Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643151 Share on other sites More sharing options...
DarkWater Posted September 16, 2008 Share Posted September 16, 2008 I want my website to pick it up and enter the sender, subject and message into the database if u got a website then why issint it correct to setup your own pm system seems a lot easer to me .......... am i going mad lol HE WANTS TO READ HIS E-MAILS, NOT READ PM'S Was that apparent enough? =/ Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643155 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 lollipop Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643156 Share on other sites More sharing options...
ngreenwood6 Posted September 16, 2008 Author Share Posted September 16, 2008 I am confused. Darkwater is right. The users on my website are not necessarily sending me the emails. It can be anyone so how can someone pm me if they are not on my site. I want all my emails sent to [email protected] to come into my database so that I can view them and reply to them. PM is not an option. Does anyone know of a solution? Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643160 Share on other sites More sharing options...
cooldude832 Posted September 16, 2008 Share Posted September 16, 2008 since we can't get a right answer try these abridged steps 1) Use IMAP to open said mailbox 2) Using IMAP again read the new messages in the box using a foreach loop 3) In the foreach loop get the send address of the mail 4) Query against your table for if that address is already present 5) If not already present insert said address 6) Close mailbox Simple enough? Note IMAP + extension library of PHP that is very poorly documented but is very useful. Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643161 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 what the 3rd party account name example hotmail , yahoo what ever tell us please........... Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643165 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 i'd never looked http://uk3.php.net/manual/en/book.imap.php Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643166 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 use curl #initialize the curl session $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://mail.google.com/mail/"); curl_setopt($ch, CURLOPT_REFERER, ""); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header'); Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643167 Share on other sites More sharing options...
DarkWater Posted September 16, 2008 Share Posted September 16, 2008 Please don't use redarrow's code. You'll want the IMAP functions. Also, I'd be willing to bet that it's his personal e-mail server that he's looking to get e-mails from, not GMail or Yahoo. Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643171 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 use this link from redarrow becouse it works................ http://www.phpit.net/article/read-email-php-pop3/ Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643176 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 Darkwater i use that code to get my mc donalds daily lol,,, i use the posted code curl function to inport anythink from any 3rd party mail server to inport users emails............ but the link ive provided below is what ur on about and i do agree but it harder to use my opionion only...... Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643180 Share on other sites More sharing options...
DarkWater Posted September 16, 2008 Share Posted September 16, 2008 That article is 2 years old and could use a LOT of cleaning up... >_> But whatever. Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643181 Share on other sites More sharing options...
cooldude832 Posted September 16, 2008 Share Posted September 16, 2008 use this link from redarrow becouse it works................ http://www.phpit.net/article/read-email-php-pop3/ The point of these forums is not to incorporate bloated third party classes but to use php to solve specific problems. The class actually is nice but doesn't teach anything Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643182 Share on other sites More sharing options...
rarebit Posted September 16, 2008 Share Posted September 16, 2008 i'd try to use IMAP, because POP3 is pants, you don't really have control on what happens on the server end. Generally when you dl a msg using POP3, it'll get deleted from the server, but depending, it might not! Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643183 Share on other sites More sharing options...
redarrow Posted September 16, 2008 Share Posted September 16, 2008 that a stupid comment, The reasson the class was put together was for all programmers to use, To learn what every function does in a class you need to read the class functions your self, as you r programming/learning the class... not everyone can just read code and program it my god man give us some help lol Link to comment https://forums.phpfreaks.com/topic/124529-mail/#findComment-643185 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.