IIZeroHourII
Eternal Poster
- Joined
- Mar 16, 2016
- Posts
- 866
- Reaction
- 315
- Points
- 348
Pahelp po Working naman sa localhost nakakapag send ng email. pero pag inupload na sa hosting site. di na nag sesend ng email.
PHP:
if($count == 1) {
$actual_link = "$_SERVER[HTTP_HOST]/php/verify_user_registration.php?student_number=$student_number&firstname=$firstname&middlename=$middlename&lastname=$lastname&suffix=$suffix&email=$newemail&verify_user_registration=";
try {
//Server settings
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'maynardhalili91@gmail.com'; //SMTP username
$mail->Password = '*******'; //SMTP password
$mail->SMTPSecure = "tls"; //Enable implicit TLS encryption
$mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('maynardhalili91@gmail.com');
$mail->addAddress($email); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Saint Jude Email Verification';
$mail->Body = 'Click this link to proceed in creating your account: '.$actual_link;
$mail->send();
$_SESSION['emailsent'] = "Check your email to Continue on registration";
header("location: ../registration-student_1.php");
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}