$mail = new PHPMailer();
            $mail->Host = "smtp.gmail.com";
            $mail->Username = "[email protected]";
            $mail->Password = "password";
            $mail->SMTPSecure = "tls";
            $mail->Port = 587;
            $mail->SetFrom("[email protected]");
            $mail->Subject = "CS50 Apparels: You just bought an item!";
            $mail->Body = "You just bought".$row['suit_name']."for".$row['price']."dollars!";
            $mail->AltBody = "You just bought".$row['suit_name']."for".$row['price']."dollars!";
            if ($mail->Send() == false) 

I fixed my previous issues, but now I'm getting an error: "The following From address failed: [email protected] The following From address failed: [email protected] SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 79sm22609146pfs.42 - gsmtp" I tried checking out the link, but it's not the answer to my question.

2 Answers 2


Missing semicolon? $mail->Host = "smtp.gmail.com" If that's not it, try an internet search "phpmailer unexpected t_variable". Lots of folks outside CS50 have experience with phpmailer.

  • 1
    I edited my code and question :)
    – Student
    Dec 30, 2015 at 17:11

I see that one crucial property is missed:

$mail->SMTPAuth = true;

Read more: http://phpmailer.worxware.com/?pg=properties

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .