I'm trying to access yahoo mail IMAP server with a php script. I read that yahoo requires a specific IMAP command “ID ("GUID" "1")”. How do I send this command ?
As of this writing, I don't believe you can access Yahoo's IMAP services externally. However, in general, you will want to use socket functions.
http://us.php.net/manual/en/ref.sockets.php
This library was released a couple of days ago and says it supports Yahoo!'s IMAP variant: http://github.com/petewarden/handmadeimap (I've not tried it myself)
Related
I was using imap functions in my app to access gmail. Unforunately I have not been able to use imap any more. I am using php. Is there any alternative way like (api..) to access gmail.
I appreciate any help.
In short, no. The only GMail API which provides access to mail is the IMAP one.
You don't explain why you can't use imap any more, but that's ok.
You can use php imap extension to connect with pop3!
Here is an example.
Try Zend Framework:
Code is Here
http://framework.zend.com/manual/en/zend.mail.read.html
I have a web account on Windows using PHP with Godaddy. Godaddy want their users to use gdform.php when I would rather use some my own custom php script.
Is it possible to send PHP mail with out the mail() function?
http://phpmailer.worxware.com/
http://swiftmailer.org/
Both these are super-powerful mailing classes for PHP. I use PHPMailer to send out 30,000+ emails per day on my company's online application.
Here's the thing though, I have several simple contact forms on small customer websites hosted by GoDaddy that are using php's mail() without fail. They may tell you not to use it, but it's sure working just fine for me....Or perhaps the Windows servers aren't running PHPMail. As an aside, I'm getting as far away from GoDaddy as quickly as possible.....
Try PEAR::Mail with native SMTP. And there are other pure PHP implementations.
Try Zend_Mail, Great features and easy to use, although I've heard stuff about it's numerous bugs but I'm not sure how much those rumors are true.
I've got google apps setup on my server with all the correct MX records etc, now i want to start testing it.
I want to use it for all automated
emails (registration, lost password
etc).
I'm testing on a localhost.
You'll probably want to use PEAR Mail, and set it up using the SMTP settings provided to you by Google. I don't believe the built-in mail() command supports TLS, which is required for sending using Google.
Ok, the solution i've found is to use the PHPMailer class found here:
http://phpmailer.worxware.com/
I was wondering how one would go about writing a php script to access mail from yahoo or gmail ?
The "simplest" way would be to use IMAP to access the mails (i.e. don't try any kind of HTML scraping !). I have no idea for Yahoo, but I know you can enable IMAP in gmail.
There are several libraries in PHP that allow one to use the IMAP protocol to access a mailbox ; for instance :
There are functions provided in PHP (You might have to install the extension, though) : IMAP, POP3 and NNTP
Or you could use something like Zend_Mail.
You could use the Zend Framework Zend_Mail functionality, this would allow you to connect to GMail/Yahoo/etc with POP3 or IMAP.
One more to add to Pascal's suggestions: libgmailer
i tried googling but sadly i get only documentations (or am i using bad keywords)
anyway
i can see that alot of programmers (even those im working with right now) does not seem to approve to using the php native mail function and resorts to using some other framework like sendmail? swift mailer etc...
i'd like to know why? are there really disadvantages to using the native mail function?
if so how does the mailing frameworkds solve that or how are they better??
There's nothing wrong with it for sending simple plain text emails.
However, once you get into multipart mime emails (say, you want an HTML version or to add an attachment) then you have to build the email yourself, and it can be quite tricky to get all the headers and encoding correct. In this case you're better off using a library.
The PHP manual for function mail mentions that there are some restrictions with the mail function and one of these are that the function opens and closes an SMTP socket for each email. The mail function works good when you just want to send a mail or two.
As far as I'm concerned, all of these problems pale in comparison to the major security problem:
Mail header injection: ( http://en.wikipedia.org/wiki/E-mail_injection , and php specific info: http://www.damonkohler.com/2008/12/email-injection.html )
Whereby a spammer bot spiders your site and, finding a vulnerability in your script that is easy to still have when using the very insecure mail() function, IS ABLE TO SEND EMAIL FROM YOUR SERVER TO AN ARBITRARY LIST OF CONTACTS, essentially turning your script & server into a cog in their spam email machine.
I recommend never using mail() with user input, and in general, just making use of PEAR::mail instead. http://pear.php.net/package/Mail/
Using PHP's mail() function requires a properly configured sendmail or equivalent on the host the program is running. However, the Windows implementation is a bit different. If you don't have your MTA configured properly, you won't be able to successfully send emails from your PHP scripts. Like another commenter said on this thread, PHP manual explicitly states that each call to the mail() function opens and closes a socket. This can cause unnecessary delay in script execution.
Additionally, your development and testing environment may not have a public static IP address. Your IP address might be blacklisted by DNSBL, Gmail, Yahoo! and other popular email service providers.
Your best bet in this situation is to use a properly configured external SMTP server. Chances are your employer has already provided an email account with SMTP access. If you don't have one you can use a Gmail account. Gmail provides SMTP access to all email accounts.
You can write scripts to open a socket connection to the external SMTP server. When there are tried and tested open source libraries for this purpose, why write your own?
Incidentally, I wrote a blog post on the very same subject yesterday: Using SMTP With Zend Framework - Solve Email Delivery Problem
Best regards,