When I manually add a user to my simple script with php 7.4 and using mysqli, no email is sent to him, why?
<?php
require_once 'core.php';
include ('phpmail/class.phpmailer.php');
include ('phpmail/class.smtp.php');
$valid['success'] = array('success' => false, 'messages' => array());
$Mesagetopic = "Welcome my area..";
$Mailsendto = $uemail;
if($_POST) {
$userName = $_POST['userName'];
$upassword = md5($_POST['upassword']);
$uemail = $_POST['uemail'];
$sql = "INSERT INTO users (username, password,email)
VALUES ('$userName', '$upassword' , '$uemail')";
$basarili = $valid['success'] = true;
if($connect->query($sql) === TRUE) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp.yandex.com'; //Smtp Host
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->Username = "axxxxx@yandex.com";
$mail->Password = "xxxxxx";
$mail->SetFrom('axxxxxx@yandex.com', 'Hello');
$mail->AddAddress("$Mailsendto", 'Oliver T.');
$mail->CharSet = 'UTF-8';
$mail->Subject = "Hey Read Me>>";
$mail->MsgHTML("$Mesagetopic);
$valid['success'] = true;
$valid['messages'] = "User Added";
}
else {
$valid['success'] = false;
$valid['messages'] = "Error! No Add";
}
// /else
} // if in_array
$connect->close();
echo json_encode($valid);
What could cause this error, e-mail why not go after manual record insertion? There is no attribute error in my html codes that submit the form
source https://stackoverflow.com/questions/76596193/after-adding-a-user-manual-i-cant-send-an-email
No comments:
Post a Comment