• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

wordpress using class.phpmailer.php in script


Don't you just love the way wordpress hides all the error messages so you can't see what is going wrong?!

I am trying to create my own contact form, and has some assistance a little earlier...  A bit of background, I want to use my own php/jquery script to validate/process the form and I have used the script from one of my existing sites (which works perfecto)

I have got as far as validating the form and getting to the point where it is ready to send the form to an email address.

to do this I am using class.phpmailer.php, which I am requiring via php

the class appears to be loaded as I can successfully initiate it as follows:

$mail = new PHPMailer();

however, all of the code executes until the $mail->send(); call

I cant see what the error is because wordpress is hiding it, any ideas what could be going wrong?


$mail = new PHPMailer();
			$mail->Host     = "mail.somedomain.com";
			$mail->Mailer   = "smtp";
			$mail->SMTPAuth = "true";
			$mail->Username = "user@somedomain.com";
			$mail->Password = "****";
			$mail->From= $email;
			$mail->Subject = "Website Enquiry " . $subject;

			$mail->Body = $message;
			$mail->AltBody= $mess; 

Open in new window

  • 4
  • 3
1 Solution
Jason C. LevineNo oneCommented:
Cycle dude,

Wordpress hides errors on purpose.  You can enable debug mode to view and/or log.


So after enabling debug mode, what do you see when the script is called?
cycledudeAuthor Commented:
hi jason

I have juust worked out how to enable debug mode

define('WP_DEBUG', true);

thanks... I am looking at whats going wrong now... so much easier when you can see errors!

Jason C. LevineNo oneCommented:
It really is.  But always remember that Wordpress is aimed at the end users who tend to have unreasonable reactions to things like warnings or errors. So the Dev team thoughtfully hid them.  Of course, those of us who need those things also can't see them :)

Getting it back is simple enough and if you really dig, there are plugins that will do all sorts of logging and reveal all sorts of stuff that goes on under the hood.  Worth investigating if you are going to spend any time at all under the hood.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

cycledudeAuthor Commented:
thanks fellas, jason you are right... there are a frightening number of warnings that are being hidden! lol

cycledudeAuthor Commented:
hurrah, once I could see what the error was I was able to right it...
in my case, the class.phpmailer.php was unable to locate both the pop3 and smtp class files it needed, once this was sorted it worked.

happy days!
Jason C. LevineNo oneCommented:
Awesome! By my count, you've more or less solved your last two questions yourself.  When do we get to see you start answering alongside us and earn the free membership?
cycledudeAuthor Commented:

lol, yep I usually find it easier to answer after I have typed in the question!...

I don't mind paying, this site is a great resource for me, as I have so many questions!


Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now