i need to know how to make a script a user can send an email to for example (forum@digitalpoint.com) once he send that mail ,the message is written automatically in database ------- i see this idea in a lot of ticket systems user send support to once he send from his mail if he opened ticket system script he can find the message he sent by mail it is in hosting companies as hostgator,webhosting pad http://support.webhostingpad.com/ any help for how to do such algorithm? codes are recommended as i am a php beginner
Ummm that's as straightforward as it can be... Try something in the line of $from = $_POST['from']; $to = $_POST['to']; $subj = $_POST['subj']; $msg = $_POST['msg']; mail($to, $subj, $msg, 'From: ' . $from . "\r\n"); mysql_query("INSERT INTO tbl VALUES($from, $to, $subj, $msg)"); Code (markup): The data should be sent via a form that contains 'from', 'to' and 'subj' as input text boxes and 'msg' (usually textarea). "tbl" is the name of the table where you want the data stored, and a mysql connection should have been created beforehand.
1) You need to arrange with your email provider to have incoming messages piped to a script. Not all shared hosts will do that, though it's easy to set up on VPS/dedicated. 2) You can read the message thusly: $message = file_get_contents('php://stdin'); Code (markup): 3) The header is separated from the message by a single blank line. If it's a MIME message then you'll have to do more parsing. There are probably PEAR libraries for this but I find PEAR quality to be so uneven that I have stopped considering it.
I agree with you. It is most likely the easiest php there is. Search google for anything related to php mail and you will get the same results.
Apart from the fact that the OP probably wanted to parse ALL email correspondece between the email-address (ie. a support address or something similar) and the clients - even if the clients does not use the form on the page, but emails directly to the email-addresse from an emailclient. THAT has to be done on the server while parsing the received emails, and isn't really a PHP-question.
i want the user to send mail from his yahoo mail not to open a script and pos,when he send from his yahoo mail or gmail,the message is written to database
We don't know your hosting service, but what you should do is contact the support at whereever you are hosting your site, and ask what services they provide for parsing received emails to a database. If you are on a dedicated server, where you have full access to all the configuration files, you should hire someone familiar with scripting and the operating system on the box, and have them make you a script. Take note, however, that you need to provide some sort of identifying header (or ID-number) on the email (could just be the subject header, or a certain ID-number stored in the email itself) so you know which emails belong to a certain client/support issue (if you base it on the email-address of the sender, all support issues will be put together). It is basically something that need to run on the server itself, and there are way better ways to do this than using PHP. If you are on a linux server, python classes and a parsing from the receiving mail-software is probably a good way to do it.
Unfortunately, if that doesn't make sense to you (or serve as a usable base for googling further) then you'll probably have to hire someone to help you. Not me, though; no free time.
as the simplest method up there, more explaination from me : first, send the email, then second, add to database, you can not do both action at the same time. correct me if i am wrong.
He doesn't want to send mail, he wants to receive it. That requires server integration outside of the PHP context.