Month: June 2021

Email send using phpmailer

                    $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 = 'ssl'; // secure transfer enabled REQUIRED for Gmail
					$mail->Host = "smtp.gmail.com";
					$mail->Port = 465; // or 587
					$mail->IsHTML(true);
					$mail->Username = "xxxx@xxx.com";
					$mail->Password = "xxxxx";
					$mail->SetFrom("example@gmail.com");
					$mail->Subject = "Test";
					$mail->Body = "hello";
					$mail->AddAddress("xxxxx@xxxxx.com");

					if(!$mail->Send()) {
						echo "Mailer Error: " . $mail->ErrorInfo;
					} else {
						echo "Message has been sent";
					}