I have a strange requirement.
I need to read the outlook emails from a local pc using php .
I will get user credentials.
so is there any way to do this ?
it need to work well in all major browsers.
Thanks.
Not sure why you would want to try to get this from a LOCAL mail file on a 'single' pc, I would rather attack this from a POP3/IMAP route, it would THEN be a PHP based mail client, or whatever you need it for (fetching mail, filtering, checking, triggering an event, etc;).
But what you describe is just not feasible for anything, I can't see a client paying to have simple client mail accessed via PHP.
Here are some PHP / Email reading references:
http://garrettstjohn.com/entry/reading-emails-with-php/
http://davidwalsh.name/gmail-php-imap
http://www.tuxradar.com/practicalphp/15/6/3
Related
So I downloaded the Free Edition of MAMP free, and found out that it doesn't initially allow sending mail through PHP.
My question is very simple. What is the best and easiest way to enable it?
Thanks in advance.
This is probably not really the answer you are looking for, but if you're set on sending emails try a program like https://github.com/PHPMailer/PHPMailer
it will enable you to send emails through an SMTP server (like gmail). It will make sure your emails get delivered while working on localhost. When going live you could tell it to use PHP mail in the config (which is actually never recommended because of the spam factor and limited functionality).
That being said, while on localhost it shouldn't be necessary to send emails. Being that localhost usually implies a staging/development surrounding. What I like to do is output the to be sent email to my error log.
http://us3.php.net/manual/en/function.error-log.php
You can instantly tell how it looks and you get confirmation that your script has run that part.
It is not possible for you to send email from local server like WAMP,XAMP.
I have a script set up that will email a user an activation link when they insert their email into the provided input.
I'm using CodeIgniter's email class to send the multipart emails and the problem I'm having is that when the email is sent, the debugger says that the email was sent sucessfully but the message is never received.
When I send the email to my internal work email, it sends just fine. But when I send it to my gmail account, it never comes through.
I've managed to track down the issue as being a problem with inserting links within the email. When I remove the link, the email sends fine. I put the link back in and the email is never received by my gmail account.
Has anyone ever come accross this problem or do you have any insight into how to fix this?
your email is being rejected.. this is no CI issue..
Ok, so it sounds like the problem isn't with CodeIgniter or your code, but with the server's mail transfer agent sending it on to the Gmail server.
What happens is CodeIgniter puts together an email and gives it to the PHP engine, which passes it on to the mail transfer agent on the server for sending. The MTA will report back to PHP, and therefore CodeIgniter, that it has received the email properly. As PHP & CodeIgniter's jobs are finished at this point, they will report that they've sent successfully.
Check your spam folder in your Gmail to see if it's been put in there..? I haven't used CI for a while so can't remember exactly, but I think there's an HTML-email parameter you may need to set before you send. If so, Gmail might be expecting this to be set too.
Scroll down to 'Email Preferences' here:
http://codeigniter.com/user_guide/libraries/email.html and set the mailtype to HTML.
If that doesn't work, you will need to debug fully.
To debug the problem properly you will need to be able to access the MTA logs. Is this a local development server or a live production machine? Is it Linux or Windows? If Linux, which distribution? Do you know which MTA you are using? Do you have SSH access to the server?
If you can get SSH access and find out which MTA you have things will be a lot simpler to find out and you'll be able to monitor the outgoing messages and the destination servers' responses as they happen.
As i'm knowing just about PHP and don't know at all about Mail Servers, what i want to know here is:
How can i get the "Replied" emails (from the receivers) for the mails i've send (by using PHP, with a address like xxxxxxx#gmail.com)
Does it need to setup my own Mail Server?
Unless using own Mail Server, is there any other easy way?
Honestly i'm not well understanding over IMAP or Email Protocols. Doing setup my own IMAP Server is far worse. Can it be done simply with a Web Hosting which supporting IMAP protocol? Or do i need to setup manually out from the start?
To be brief, i need a simple guide.
You only need a mail server if you don't already have a place where those reply-tos end up. Which adress are you sending them as? Where would you fetch the emails for those adress? You can ask PHP to log into any mail server that you'd fetch your emails from manually as well, so there shouldn't be a problem. But maybe I'm not getting you right.
Simply put the reply address to an email you own. For the example you gave to work, you would need to have the xxxx#gmail.com account.
Most people use something along the lines of mailer#youdomain.com, ans then create an account for that on their ma8lserver.
If you want to use your own domain, you don't need to run your own mailserver. Gmail, hotmail, and others have services that let you use their mailservers for your fomain, for free.
When sending a email via php i want it to appear in my outlooks sent items.
I have tried imap_send but it does not reflect in the sent items. Is this possible. Thanks
edit
i used imap_append to solve achieve this.
imap_append($connection, "{mail.example.com/novalidate-cert}INBOX.Sent")
The only way that I know for 100% sure this is possible is by sending through an Exchange account. That way, Exchange will sync the sent items folder on an Outlook client.
If your PHP instance is on the same machine as the Outlook instance, this may be what you're looking for - although I haven't tried it so I don't know if it works.
If your PHP instance is not on the same machine as Outlook and you don't use Exchange, you're scuppered.
EDIT
It may be possible to do this with IMAP, as long as you configure Outlook correctly, but it would also depend on the mail server keeping a local sent items folder and handling mail sent through it correctly, which it may not.
I would like to have a server that is able to receive emails. Then I want to use PHP to program the way the emails are shown to the users. Can I do it purely with PHP? I mean, it is not a problem to send emails from PHP but I do not know if I can receive emails by PHP? (In a way PHP receives POST requests).
ADDED
As a response to the first answer, I would like to specify that it looks like I need an SMTP server. I want to be able to communicate with the SMTP server in a programmatic way. For example, I want to have a possibility to "tell" to the SMTP server to create a new e-mail address. I also need to know where incoming emails stored and in what format. For example, how I can extract the "sender", "cc", "bcc" from the file corresponding to the received mail.
would like to have a sever that is able to receive e-mails.
If you are writing it from scratch then you'll need the specification for SMTP. I would advise very strongly against this. SMTP servers are hard to write, and there are several really good open source solutions out there.
My understanding of PHP is that it does very poorly when it comes to multithreading, so it probably isn't a good solution for this problem.
Than I want to use PHP to program the way the mails are shown to the users
Servers that receive mails do not typically show them to users. They usually store them in a standard way (such as Maildir or mbox) which other software (such as a local email client or an IMAP server) accesses.
The job of showing email to a user is belongs to email clients. Web based PHP web mail software includes SquirrelMail and RoundCube. AFAIK they both act as IMAP clients. See the IMAP specification.
As a response to the first answer, I would like to specify that it looks like I need a SMTP servers. I want to be able to communicate with the SMTP server in a programmatic way. For example, I want to have a possibility to "tell" to the SMTP server to create a new e-mail address.
Pick an SMTP server that runs on your OS. Read the instructions to find out how to configure delivery and accepted addresses. It usually comes down to manipulating text files.
I also need to know where incoming mails stored and in what format. For example, how I can extract the "sender", "cc", "bcc" from the file corresponding to the received mail.
Again. See the manual for the mailserver. Most will give you options about where to store the data and in what format.
Then you just need to decide if you are going to get PHP to dig into those directly, or use an IMAP server in between.
No, that is not easily possible. PHP is made for (stateless) http protocol, while a mail is sent in a conversation that is built up from various requests and responses.
It is possible to parse and process mails using PHP, but I would recommend installing a mailbox that you can read from PHP using POP3. Then, your PHP application can show and process mails from that mailbox.