Click to See Complete Forum and Search --> : recieving emails


dello
10-02-2004, 05:25 AM
hi everybody,

I'd like to make an email.. I mean like yahoo, for my own site. Well, it's a matter of designing a form and using the functions mail and is_uploaded_file for creating a compose page. But what I want to know is, how the inbox is built? I mean, how can I list the recieved emails? Is it made already in my mail server or should I call a function for that? I have no idea about it, and I really do need it.

thx,
dEllo.

JavaHead Jonnie
10-02-2004, 05:49 AM
OK; I'm guessing you want people to be able to sign up for email accounts. That's tricky - The easiest method would be to setup a catchall email address and display messages based on the actual to address.

But I must warn you - it's a big task; I've done it before and I'd let you have a look at the code but it was lost when I had to reinstall 'Mandrake. (:()

Anyway, take a look at the following functions: mail funcs (http://www.php.net/mail), mail() (http://www.php.net/manual/en/function.mail.php), mb_send_mail() (http://www.php.net/mb_send_mail), socket funcs (http://www.php.net/sockets) and > imap funcs (http://www.php.net/manual/en/ref.imap.php) <.


EDIT: here's the PEAR package (http://pear.php.net/package/Mail_Mime).

dello
10-02-2004, 06:47 AM
thank u alot Perdo, I appreciate ur help. :)

mmmmmm, I think I didn't make my self clear :D
Well, the ppl who'll be able to have an account are registered by me. I mean they'll be few ppl who'll be authorized to have an account at the site. So I want to know how to creat an inbox for those authorized ppl who are registered by me (the webmaster).

any help or suggestions will be ahighly appreciated,
dEllo.

JavaHead Jonnie
10-02-2004, 07:14 AM
OK. So if they each have their own POP3 address it's alot more simpler. You just need to take a look at the IMAP functions.

You'll want three parts to the script; A login page (You can do logins through sessions (http://www.php.net/manual/en/ref.session.php)), an inbox page and a message viewing page - then you just have to do the compose page etc. Basically, for the login page, get them to enter their username (name@domain.com) and password then try to an imap_open() with an or die() saying they couldn't be logged in. If the script doesn't die() create a cookie (setcookie()) for them conatining $user . ":" . $pass and header() them to the inbox page.

On the inbox page, make sure they have a cookie - explode() it to get the user and password and use imap_open() and loop through all the messages subjects, echo()ing them with a link to the message viewer script.

The message viewer just needs to use something like imap_body() to get the message.



Alternatively, you could just download SquirrelMail or something similar.

yuna
10-02-2004, 08:51 AM
I strongly recommend using an existing application rather than trying to build this yourself. There are many security issues involved in setting up such a site so that you won't open yourself to being a relay for spammers. The best package these days is SquirrelMail, a complete set of PHP scripts for this purpose. See http://www.squirrelmail.org/ for details.

pyro
10-02-2004, 05:34 PM
Originally posted by yuna
I strongly recommend using an existing application rather than trying to build this yourself.nods and agrees...

dello
10-03-2004, 06:12 AM
[COLOR=teal]
thank u all for ur help and suggestions.

1. Well, I'm persuaded by u all that it's better for my site's security to use an existing application for building my mailbox. I spent the whole yesterday reading about IMAP and how to use, but still believed in what u all suggested to me, which is using an existing aplication. But what I'm afraid of is the language I'm using in my site! I've faced alot of problem in recieving forms using MySQL technique, and now, I'm afraid of facing the same problems with the applications which are building the mailbox.
Afetr all I read about IMAP, I think it's not that dificult to work with, but also I'm with taking others' advise.

2. During reading about IMAP, POP3 was mentioned alot. And what I understood from the descriptions of IMAP functions is POP3 is kind of mail server. And read alot about connecting to it to list the mailbox, but yet didn't get it clearly, and should I create one or, it should be existed in my server. (?)

3. I just created an email account at my server(like myName@myDomainName.com) and tried to show the mailbox. It gave me 3 links, each is liked to a different application for building mailbox which are:
[list=a]
NeoMail
Horde
SquirrelMail
[/list=a]

And here's what I found:
[list=a]
SquirrelMail (as all of u suggested to me which I appreciate alot) works perfectly. But the only problem that would make it useless for my users is the language. It doesn't support Arabic (the email I sent through it was in arabic, and I recieved it in a strange symbols) , which is the language wanted by my customers.

NeoMail is PERFECT. I send an email with arabic letters, and the result was a readable text message recieved by my hotmail. And the NeoMail also lists the emails sent to my new server eMail.
But the only problem with it, is I have to sign out, then re-sign in again to see the new recieved emails.. also, emails recieved from YahooMail, I have to change its encoding using "View -> Encoding -> Arabic(windows) ". I wonder if there's a way to make it by default encoded to what I want.
Another thing I didn't like about NeoMail(and yet will not make me change my minde in use it as my mailbox lister) is the preferences that I have to set them each time I sign in! is there any way to make the preferences stable after the first time I set them??

Horde ... Gives me an error in opening its page .
[/list=a]
4. I have a form contains a field for "username" and another for "password", and this form takes my users to a page where the they can choose whiether checking thier email, or displaying specific information. The second option is already made in a web page. About the first option, I'm wondering if there's a way to connect to my NeoMail using the link of the first option. Do anyone has any idea how to do this? And direct my users to NeoMail not to give them options between SquirrelMail, NeoMail or Horde? Also not to display the preferences page each time the user sign in?

5. I know I've written alot of Qs :D I realllllly appreciate all ur suggestions and help. Thank u all from my heart.

reGards,
dEllo
[/COLOR=teal][FONT=times new roman]

yuna
10-05-2004, 11:43 AM
Originally posted by dello
SquirrelMail (as all of u suggested to me which I appreciate alot) works perfectly. But the only problem that would make it useless for my users is the language. It doesn't support Arabic (the email I sent through it was in arabic, and I recieved it in a strange symbols) , which is the language wanted by my customers.

Are you sure this isn't just a browser issue? If you receive an Arabic message, but have ISO-8859-1 (Western European) as your character encoding, it will always display incorrectly. What happens if you open the same message in SquirrelMail using an Arabic encoding? (In my Mozilla Firefox, that's under View | Character Encoding | More Encodings | Middle Eastern.)

As of version 1.50, translations are distributed separately from the program code in SM. You need to read this page and its links:
http://www.squirrelmail.org/wiki/en_US/CustomizingSquirrelMail

dello
10-06-2004, 12:54 AM
thx yuna for replaying

it wasn't a browser problem.. i tried to choose the Arabic encoding, but still didn't show the arabic letters.

Now, i'm using NeoMail, and it's going fine till now..
Actually, I've done all my problems thankx GOD.. and now my web site is working fine.. hope this still forever :)

thank u agian yuna

reGards,
dEllo