suppose I have an email address username@gmail.com can I use this email address to send mails through the php mailer code where in the TODOs the password is the password of username@gmail.com and username is username or does the password always have to be crimson50 and username as jharvard@cs50.net ?

/ instantiate mailer
$mail = new PHPMailer();

// configure mailer
// http://phpmailer.worxware.com/index.php?pg=methods
// http://phpmailer.worxware.com/index.php?pg=properties
// https://www.google.com/settings/u/0/security/lesssecureapps
$mail->Host = "smtp.gmail.com";
$mail->Password = "TODO";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPDebug = 1;
$mail->SMTPSecure = "tls";
$mail->Username = "TODO";

You should be able to use your own email address, not just jharvard@cs50.net. Try it!

Also, to answer a question you asked elsewhere: PHPMailer does support HTML email, so you can add the a href tags around your password reset link, or even create a more webpage-like HTML email template.

Hope this helps.

  • I get a SMTP Error: Could not authenticate. Notice: Undefined property: PHPMailer::$ErrInfo if I use my password and email address Oct 29 '16 at 6:40

You must log in to answer this question.

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