Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 4th, 2002, 08:12 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Use of '@'

In the following code an '@' preceeds the imap_open function call:

// open mailbox
$inbox = @imap_open ("{". $SESSION_MAIL_HOST . "/pop3:110}",
$SESSION_USER_NAME, $SESSION_USER_PASS) or header("Location:
error.php?ec=3");

I am unfamiliar with this. What does it do?

Reply With Quote
  #2  
Old January 5th, 2002, 12:09 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
error

after the log in portion when i add the second part i get parsing error both setions belong in index.php?

correct?

Reply With Quote
  #3  
Old January 5th, 2002, 02:12 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
let me tell you

the 'at' symbol preceding the function call prevents the interpreter from spitting out an error message on the page.

i think in this case the error message would say warning: could not establish stream line x

particularly bad if you''re trying to redirect, as it sends http headers along with the error.

you can in effect 'silence' many functions in php with the @, not just the imap functions

Reply With Quote
  #4  
Old January 5th, 2002, 08:23 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Some potential fallacies

Hi, the article was a great introduction, but I had a few concerns.. First, if the user selects a message to be deleted on the Inbox page and, in the meanwhile, a new message arrives in his inbox ( or another client deletes a message or the user accidentally reloads the delete page for some reason due to some slow network response ), another message could inadvertently be erased instead ( or multiple messages might be erased ). Next, the current setup does not account for persistence in the sense that one can only view what is currently in one's inbox. People travelling tend to get large amounts of e-mail which they cannot afford to have clogging up their account on the mail server. What would be a good approach for introducing persistence here? Would storing the messages in a database table be feasible? or would something like storing the messages in files based on the message_id's be a better solution. This would also have much to do with the notion of attachments, etc. Also, how might one address the idea of HTML-encoded e-mails? i'd imagine some sort of parsing would need to be done to strip extras out of the e-mail in this case. Thanks for a nice article.

Reply With Quote
  #5  
Old January 6th, 2002, 02:15 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thank you

Very good to know!

Thank you for the explanation.

Reply With Quote
  #6  
Old January 7th, 2002, 06:53 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
[webmaster] New archive

We've been sent a new source archive for this article. I suggest that if you have downloaded the source before 4:40 PM MST on Monday, January 7th, you download the new archive.

The new archive can be found "here":http://www.devshed.com/Server_Side/PHP/PHPMail/PHPMail1/mail.zip.

Thanks and sorry for the inconvenience.

Reply With Quote
  #7  
Old January 8th, 2002, 02:52 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
for part 2

anil has got some good points in the comment titled 'some potential fallacies':

1) it would be better to use messageIDs instead of message numbers (in case a user reloads the delete page accidentally).

2) how to have mail folders (maybe use a database?)

also, I would like to add:

3) how to distinguish read messages from unread ones, assuming we're using POP3 and not IMAP? (maybe use a database?)

4) how to improve performance time? i've had up to 7 second load times for the inbox if there are more than 20 messages there. i'm guessing that if you put the php files on the same machine that handles the email, then it would speed it up?

Reply With Quote
  #8  
Old January 8th, 2002, 11:53 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Few notes.

Hello Josh,

Nice article is this one.
Few things I would like to point out.

Firstly you have assumed that for email abc@xyz.com, xyz.com is the pop server. This is in most cases not TRUE. I guess we can ask user to enter pop server OR from the email We cant some MX record lookup and find out the pop server [ just like mail2web.com does. ]


Also, connecting to pop server every time list.php is called would be bit too much. What We can do is, when the script contacts the POP server first time, It would download all the messages and store it either in file or in db. For, one web mail project I did,I used files, but I think DB would be preferable, cause you can make table which has fields like to, from, date, remail i.e. all the mail properties and the mail body itself.

So after listing the mails, when user tries to read the mail, you just read the mail off the DB. We can also provide a refresh link by clicking on which, we would update the db with the latest state of the Mailbox.

I also found out that if PHP is not configured with IMAP support, the list.php would show blank page. It is because if imap_open function is not supported, it would result in Fatal error and script would exit immediately but as you have suppressed the error message one won’t come to know what happen. We can put up check using function_exists. [This is not all that necessary as we can safely assume the person trying to get this script running does have IMAP support !!!]

That’s it for now,
JD


url : http://www.jdk.f2s.com

email : jdk@f2s.com

Moderator at Devshed forums.
[ http://forums.devshed.com ]




Reply With Quote
  #9  
Old January 10th, 2002, 05:37 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
The loginfile

There is a type-fault in the login file:

else
{
?>

you should delete "?>"

Reply With Quote
  #10  
Old January 11th, 2002, 04:31 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Parsing

I think you are headed in the right direction for me, because I for one am not so "PERL-literate" when it comes to pattern matching regex functions. Perhaps you could include a basic explanation on that?

I am trying to develop a small script that can be CRON'ed (or tasked on NT that is...) to automatically log into the POP box, parse the days messages, and add what it matches to a database.

My problem is the pattern matching... is the body usually just stuck into one string handle and parsed with PHP's (fun) string functions?

Anyone wth any experience on this? Seems to be in demand on the other sites too (Although I am a big fan of Devshed ;)

Anxiously awaiting part two...

Reply With Quote
  #11  
Old January 11th, 2002, 08:10 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Persistence?

I'm not sure what you mean by persistence. Perhaps you could explain it a bit better. Your concerns are very reasonable, and I'd like to find a solution to them myself, but I don't think I fully understand the problem

Reply With Quote
  #12  
Old January 12th, 2002, 06:16 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
more info...

Heya,
Yea, what I meant by persistence of information was the idea that the mail messages themselves would be stored somehow on the server.. i mean.. when one checks mail with something like Netscape Mail or Outlook, one has the option of specifying to "leave messages on server". So, if this feature is not implmented, one would continually see old mails that have previously been read and perhaps should be discarded, etc. The whole notion of persistence, therefore, is in this very feature of "retaining old messages" on the server. I hope this makes my point a bit clearer. Do post maybe as a follow up somehow about ways in which this might actually be done. Thanks,
-Anil.

Reply With Quote
  #13  
Old January 14th, 2002, 08:28 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I'm not sure writing a DB with a message list is a good idea. You're immediately imposing a requirement to update both the POP server and the local DB every time the mailbox state changes - which may end up degrading, rather than improving performance.

Reply With Quote
  #14  
Old January 14th, 2002, 08:31 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I don't think you can implement that here. Don't forget, with Netscape/Outlook, messages get downloaded to the local disk. With a Web-client, they are always read on the server - which (I think) is what you want.

Reply With Quote
  #15  
Old January 14th, 2002, 10:52 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re:

Hi,
hmm... I don't think you quite understood what i was talking about. My point was along the lines of having a POP account checking capability on a service like hotmail or yahoo mail.. in these cases, the messages are retrieved from the pop server, stored on the web server ( or db, etc. ).. and then "reside" in the user's inbox until deletion. This deletion does not necessarily link to the deletion of the mail from the actual pop server's account. I hope this makes things clearer.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Building A PHP-Based Mail Client (part 1)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |