PHP Classes

view problems, solve certificate ones

Recommend this page to a friend!

      Receive Mail  >  All threads  >  view problems, solve certificate ones  >  (Un) Subscribe thread alerts  
Subject:view problems, solve certificate ones
Summary:how to show the connection problem's details+Certificate failure
Date:2009-08-21 11:25:42

  1. view problems, solve certificate ones   Reply   Report abuse  
Cedric - 2009-08-21 11:25:42
Thank you very much Mitul Koradia for this class !

I have had some problems around pop connection, so here are some solution, and also some tweaks.

In the first place, I couldn't make the class work, and couldn't understand why. I then added the line

echo "\nConnection problem: " . imap_last_error()."\n";//for dubugging purposes only

in the receivemailmail.class.php, into the function connect() :

function connect() //Connect To the Mail Box
echo "\nConnection problem: " . imap_last_error()."\n";//for dubugging purposes only
echo "\nError: Connecting to mail server\n";

this line should be a comment in the original class, but it would help programmers who want to understand why they get "Error: Connecting to mail server"


Then I could see why I couldn't connect : the error line was like that :

Certificate failure for

As I didn't care about certificate, I wanted to force to check mail all the same.

I then changed slighlty receiveMail function.

($username,$password,$EmailAddress,$mailserver='localhost',$servertype='pop',$port='110',$ssl = false,$valCertificate = true) //Constructure

and then, for POP :
$strConnect='{'.$mailserver.':'.$port. '/pop3'.($ssl ? "/ssl" : "").($valCertificate ? "" : "/novalidate-cert").'}INBOX';

If the user doesn't specify anything about certificate, it's just the same as before.
If the user specifies that he don't want to have a validate certificate, the /novalidate-cert is added.

I hope that help !

tweaks... :D
tweaks are quite subjective, so don't be offended about these proposals :)

You should add in the comment of your class where one can download the original class, so if one wants to do it another time, or get an updated version, he can.

You can write \n when you echo something as people may use command-line in the first place, and not a browser