hanwei Posted November 16, 2006 Share Posted November 16, 2006 hi, sorry to bother again.can anyone give me some example on how to get mail from a mail server and process it.For example, a user send an email to the address hanwei@test.com. The database will get the email from the mail server(hanwei@test.com), and process it.normally the basic format of an email is, To:From:Header:Message:So if i want my database automatically insert the values from the mail to my database, how am i suppose to do it?(mail) > (database)From > Client NameHeader > ProblemMessage > Problem Descriptionso can anyone give me some example or teach me on how to do it?thanks.. Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 17, 2006 Author Share Posted November 17, 2006 up~ Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 17, 2006 Share Posted November 17, 2006 To do this you are going to have to edit it cause i dont know what your trying to do but the basic background you want to use is:[code]<?php$message = "";$_from = "";$to = $row['email'];$subject = "";$headers = "From: " . $_from . "\r\n";mail($to, $subject, $message, $headers);?>[/code] Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 17, 2006 Author Share Posted November 17, 2006 oh.. for example, if i'm the user, i send a email to this address hanwei@test.com, using hotmail, google, or yahoo.this is the content of my mail: To: hanwei@test.comFrom: hanweiHeader: trouble ticketMessage : i have a trouble ticketso when hanwei@test.com received this email, the database will grab this email and process it such that,values in From will go into table column called ClientNamevalues in Header will go into table column called Problemvalues in Message will go into table column called ProblemDescits like the database will automatically grab the email from hanwei@test.com and process it, automatically insert the values in From,Header and Message into table column ClientName,Problem and ProblemDesc respectively...*sorry for my poor english.. Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 17, 2006 Share Posted November 17, 2006 That script will go ahead and process it. do you want it to put the information that people send into the database, so you can look at it. or something like that. Please explain what you want to accomplish with putting it in the database. BTW Your english is fine. Quote Link to comment Share on other sites More sharing options...
brendandonhue Posted November 17, 2006 Share Posted November 17, 2006 You can use the IMAP functions to fetch mail in PHP:http://us2.php.net/imapOr you can set up email piping on your server to have the emails sent to your script. Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 17, 2006 Author Share Posted November 17, 2006 Hi, i want the database to automatically insert the values( From, Header, Message) into my table. the table consist of column called ClientName, Problem and problemDesc. i want the script to insert From, Header and Message into column clientName, Problem and problemDesc respecitively. i have already created a script whereby it will print out all the tickets created. so if my database grab an email from hanwei@test.com, it will create a new ticket. it acts like a page similar to client submittion. but now the ticket is created when client send an email to my mail server and my database will grab the mail and create a ticket. if the database is able to insert the values into my table, i will be able to print out the result on my page. Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 19, 2006 Author Share Posted November 19, 2006 up~ Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 19, 2006 Share Posted November 19, 2006 there would be no need to insert it into a database Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 19, 2006 Author Share Posted November 19, 2006 i want it to insert into the database so that i can print out the newly created ticket.anyone know how to do it? Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 19, 2006 Share Posted November 19, 2006 O ok you should of just said that earlier, like a support ticket. Ok I can do that. Do you have msn, aim, etc. and ill make it, i'm going to be needing to talk to you faster for this. Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 20, 2006 Author Share Posted November 20, 2006 hi, i just want to know how to grep data from the email and insert it into my table. do i have to make use of sendmail client or other method?thanks Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 20, 2006 Share Posted November 20, 2006 No its hard to explain, but I know how to do it, Please Contact me. Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 20, 2006 Author Share Posted November 20, 2006 hi,why not u post examples or explain the steps here so that everyone knows how to do it.thanks Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 20, 2006 Share Posted November 20, 2006 I will when we get the full script up and working Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 20, 2006 Share Posted November 20, 2006 There are a two of ways to read and parse email messages using PHP.You can used the [url=http://www.php.net/imap]IMAP[/url] functions to read either IMAP or POP3 mailboxes or you can have email addressed to a particular address sent directly to a PHP script which processes it.Here is a web page that explains the second method:http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.htmlKen Quote Link to comment Share on other sites More sharing options...
hanwei Posted November 24, 2006 Author Share Posted November 24, 2006 up~ ?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.