E-mail activation not working with php mail

I will try both method, including the Hotmail one but for this line of code: $mail->addAddress(‘$to’, ‘$first, $last’); // Set the recipient of the message.

Do I need the quotation mark if I am using variables?

You must not need the “quotation marks” you called if you’re using variables. You would define them on your code by using this example: $exampleVariable = "test123";, where exampleVariable is the name of the variable that you can change and “test123” is the value (can be a boolean, a string or a integer).

I can’t get either my gmail or Hotmail to work with my credentials: I have put asterix in my password to hide it:

// Edit this path if PHPMailer is in a different location.

require ‘./PHPMailer/PHPMailerAutoload.php’;

$mail = new PHPMailer;

$mail->isSMTP();

/*

  • Server Configuration

*/

$mail->Host = ‘smtp.gmail.com’; // Which SMTP server to use.

$mail->Port = 587; // Which port to use, 587 is the default port for TLS security.

$mail->SMTPSecure = ‘tls’; // Which security method to use. TLS is most secure.

$mail->SMTPAuth = true; // Whether you need to login. This is almost always required.

$mail->Username = “[email protected]”; // Your Gmail address.

$mail->Password = “**********”; // Your Gmail login password or App Specific Password.

/*

  • Message Configuration

*/

$mail->setFrom(‘[email protected]’, ‘Awesome Website’); // Set the sender of the message.

$mail->addAddress($to, $first, $last); // Set the recipient of the message.

$mail->Subject = ‘PHPMailer GMail SMTP test’; // The subject of the message.

/*

  • Message Content - Choose simple text or HTML email

*/

// Choose to send either a simple text email…

$mail->Body = ‘This is a plain-text message body’; // Set a plain text body.

// … or send an email with HTML.

//$mail->msgHTML(file_get_contents(‘contents.html’));

// Optional when using HTML: Set an alternative plain text message for email clients who prefer that.

//$mail->AltBody = ‘This is a plain-text message body’;

// Optional: attach a file

$mail->addAttachment(‘images/phpmailer_mini.png’);

if ($mail->send()) {

echo “Your message was sent successfully!”;

} else {

echo "Mailer Error: " . $mail->ErrorInfo;

}
The variables are taken from my registration page… I think the mail function should work but do you guys have any rules in using mail? Maybe I didn’t set up something correctly?

This is very peculiar indeed because I got my email to be saved in a text file but just won’t show up in my actual inbox message… I think this could be some kind of security setting on your end… so the mail function is working

-==Multipart_Boundary_x913a411a0db3977c2c637ce60e6d5487x
Content-Type: text/html; charset=“UTF-8”
Content-Transfer-Encoding: 7bit

Activate your Primer Level Membership Plan!

Dear Mervin Lee,
Thank you for registering your Primer Level Membership Plan with PianoCourse101! You are receiving this e-mail because you or someone else claiming to be you has selected a Primer Level Membership Plan

If you believe that this is a mistake, please send us a ticket with the subject “How to cancel my Primer Level Membership Plan?” and allow at least 48 hours before receiving a reply.

However, if this is correct, then you must activate your Primer Level Membership Plan by clicking on the link below:

<a href=https://www.pianocourse101.com/[email protected]&activatetoken=cqffqcaqbR>Click here to activate your Primer Level Membership Plan.

Alternatively, you can use the following token to manually activate your Level 3 Yearly Membership Plan by clicking on the ‘Activate Membership\s Section:’

Token:.cqffqcaqbR;

This is a weird problem

I actually don’t have ssl enabled yet, will this affect my phpmailer and mail function? I am waiting for cloudfair to be activated…I tried it with hotmail but still can’t get it to work…

SSL doesn’t affect PHPMailer and mail() functions on InfinityFree; they remain all the same. Cloudflare acts as a DNS manager, SSL issuer and a reverse proxy that needs that the IP is online in order to do this.

It is still weird that my files are saving into my text file but not displaying them

Is the error log working? Will it display any errors there?

I don’t know if the error log is working for emails and displays errors related to email sending, but the error log is working for your website and, if you badly configured the software, you would be presented with an error log, or if it doesn’t print the errors, use PHP Display Errors on Alter PHP Config.

I have disabled the following line of code but still can’t send the mail from my live server:

//$mail->IsSMTP(); // enable SMTP

I have uploaded the files to my phpmailer folder in my htdocs folder

Don’t disable the isSMTP() function on PHPMailer! Doing so SMTP doesn’t work anymore! Uncomment it if you want SMTP on PHPMailer to work!

You can connect to the port 25 (not secure) if SMTP with a secure SSL/TLS or STARTTLS protocol doesn’t work for you. Just change the $mail->SMTPSecure variable to false and the $mail->Port variable to 25. Then connect to the SMTP using smtp.gmail.com as host, and your Gmail account email and password, but first enable “Less Secure Apps” on the Google account settings on Security and disable the CAPTCHA request on login.

so just to confirm that instead of having $mail-> ‘tls’ or ‘ssl’, i should put ‘false’?

$mail->SMTPSecure should be set to false, without single quotes. false is a boolean value.

I tried to include the php mailer in another file to test it and I got the following: Is this good or bad?

require ‘PHPMailer/PHPMailerAutoload.php’; /* * Server Configuration / $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 2; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = false; // secure transfer enabled REQUIRED for Gmail $mail->Host = “smtp.gmail.com”; $mail->Port = 25; // or 587 $mail->IsHTML(true); $mail->Username = “[email protected]”; $mail->Password = "*****"; $mail->SetFrom(“[email protected]”); $mail->Subject = “Test”; $mail->Body = "

hello

"; $mail->AddAddress(“[email protected]”); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo “Message has been sent”; }

It is outputting the word hello… It is showing hello on the screen but not sending to my gmail and I have checked my gmail security setting… The option is turned on to allow less secure app

The good news is that I can get the following to be displayed on the screen but I thought that the user should not be able to see this though?

ZKetRzSgeBxB8RWQUEUm6maABvSV2NHkQ0uu-42CKAv_Acva> Please534-5.7.14 log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 Can't sign in to your Google Account - Gmail Help n3sm1437002wro.59 - gsmtp
2019-06-15 03:21:06 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&amp;scc=1&amp;plt=AKgnsbu8534-5.7.14 iYTeoJ7exkwFMGha049R1wODHvS3WyVzZM2LYN6ws8E9NWU3N0ub26YVEFtTFgszDJ8OCh534-5.7.14 sefnl3Gn6G5fV-ZKetRzSgeBxB8RWQUEUm6maABvSV2NHkQ0uu-42CKAv_Acva> Please534-5.7.14 log in via your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 Can't sign in to your Google Account - Gmail Help n3sm1437002wro.59 - gsmtp
SMTP Error: Could not authenticate.
2019-06-15 03:21:06 CLIENT -> SERVER: QUIT
2019-06-15 03:21:06 SERVER -> CLIENT: 221 2.0.0 closing connection n3sm1437002wro.59 - gsmtp
SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub
Mailer Error: SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub
Warning : Cannot modify header information - headers already sent by (output started at /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/PHPMailer/class.smtp.php:239) in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 628

I also got the 502 gateway error because I entered port 25… port 25 does not work…

I’ve told you to unlock the CAPTCHA request to each login with this link by the Google account you’re trying to use PHPMailer on!
Port 25 for me works, but I programmed a script that works on the SSL security mode of Gmail SMTP. Try connecting to the SMTP via this command by Terminal, PowerShell or CMD (if you’re using Windows you need to enable Telnet as a new functionality):
telnet smtp.gmail.com 25
Digit “quit” to exit from the Gmail SMTP,
and do the same with the other ports like the SSL one:
telnet smtp.gmail.com 465
quit
If you’ve reached the SMTP screens then you know they work. And then on the configuration change $mail->Port from 25 to 465 and $mail->SMTPSecure from false to “ssl”.

I clicked on that link but now it says something about this:

Now you can access the account from PHPMailer. Close that screen.

I am also trying the telnet from my c:\users\piano directory but says that telnet is not recognised command