Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

SMTP Debugging update

Hi, now in the Github gmail example SMTPDebug part looks like this:

$mail = new PHPMailer();
// //Tell PHPMailer to use SMTP
$mail->isSMTP();
// //Enable SMTP debugging
// // SMTP::DEBUG_OFF = off (for production use)
// // SMTP::DEBUG_CLIENT = client messages
// // SMTP::DEBUG_SERVER = client and server messages
$mail->SMTPDebug = SMTP::DEBUG_SERVER;

However, when I use it this updated way, my app crashes after submitting a form and I receive status 500 error. When I use it "old way" (setting it by number- 0, 1 or 2) it works just fine. I'm using MAMP as my local php environment.
Any clues why is it happening?

2 Answers

Is there a reason you're not using

$mail->SMTPDebug = SMTP::DEBUG_SERVER;

?

Not sure if that is a fix but that is the code I found in the gmail example (and in what you posted above)

I meant exactly your code. Sorry, small mistake in my post - corrected now. Anyway, not working neither with your nor mine version. Working with 0,1 or 2. Maybe MAMP has something to do with this?