kipper Posted July 31, 2010 Share Posted July 31, 2010 How does a web server, with a database connect to the emails it receives? How does the web server get the contents of the emails it receives so I can parse it? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/209443-access-email-contents/ Share on other sites More sharing options...
Daniel0 Posted July 31, 2010 Share Posted July 31, 2010 The web server doesn't receive any email. That would be the MTA (mail transfer agent). Many Linux based MTAs use the /etc/aliases file to specify where the emails should be routed to. By default it's a user on the file system, but it's also possible piping it to STDIN on a script. This line would send email to something@example.com to to the user daniel: something: daniel This line would send email to something@example.com to a script called parse.php: something: "| /usr/local/bin/parse.php" In parse.php you can then use the I/O streams to read the email from STDIN. The input format is the usual email format, i.e. first the headers, then a blank line and then the body. That should be trivial enough to parse. Quote Link to comment https://forums.phpfreaks.com/topic/209443-access-email-contents/#findComment-1093562 Share on other sites More sharing options...
Pikachu2000 Posted July 31, 2010 Share Posted July 31, 2010 I don't pretend to know anything about this particular package, but there's a mailparse PECL extension. You can look at it and see if it might work for you. Quote Link to comment https://forums.phpfreaks.com/topic/209443-access-email-contents/#findComment-1093571 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.